File tree Expand file tree Collapse file tree 4 files changed +15
-17
lines changed Expand file tree Collapse file tree 4 files changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,14 @@ impl ClientCodec {
5353 }
5454 if self . escape_count == 3 {
5555 self . escape_count = 0 ;
56- buf. write_all ( & frame[ start..idx] ) . await ?;
56+ buf. write_all ( frame. get ( start..idx) . unwrap_or_default ( ) )
57+ . await ?;
5758 buf. write_all ( b"." ) . await ?;
5859 start = idx;
5960 }
6061 }
61- buf. write_all ( & frame[ start..] ) . await ?;
62+ buf. write_all ( frame. get ( start..) . unwrap_or_default ( ) )
63+ . await ?;
6264 Ok ( ( ) )
6365 }
6466 }
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ impl ServerInfo {
144144 features. insert ( Extension :: StartTls ) ;
145145 }
146146 Some ( "AUTH" ) => {
147- for & mechanism in & split[ 1 .. ] {
147+ for & mechanism in split. iter ( ) . skip ( 1 ) {
148148 match mechanism {
149149 "PLAIN" => {
150150 features. insert ( Extension :: Authentication ( Mechanism :: Plain ) ) ;
Original file line number Diff line number Diff line change 2121 unused_import_braces,
2222 missing_debug_implementations,
2323 missing_docs,
24- clippy:: explicit_iter_loop
24+ clippy:: explicit_iter_loop,
25+ clippy:: unwrap_used,
26+ clippy:: expect_used,
27+ clippy:: indexing_slicing,
28+ clippy:: string_slice
2529) ]
2630
2731#[ cfg( not( any( feature = "runtime-tokio" , feature = "runtime-async-std" ) ) ) ]
Original file line number Diff line number Diff line change @@ -10,22 +10,14 @@ pub struct XText<'a>(pub &'a str);
1010
1111impl Display for XText < ' _ > {
1212 fn fmt ( & self , f : & mut Formatter ) -> FmtResult {
13- let mut rest = self . 0 ;
14- while let Some ( idx) = rest. find ( |c| c < '!' || c == '+' || c == '=' ) {
15- let ( start, end) = rest. split_at ( idx) ;
16- f. write_str ( start) ?;
17-
18- let mut end_iter = end. char_indices ( ) ;
19- let ( _, c) = end_iter. next ( ) . expect ( "char" ) ;
20- write ! ( f, "+{:X}" , c as u8 ) ?;
21-
22- if let Some ( ( idx, _) ) = end_iter. next ( ) {
23- rest = & end[ idx..] ;
13+ for c in self . 0 . chars ( ) {
14+ if c < '!' || c == '+' || c == '=' {
15+ write ! ( f, "+{:X}" , c as u8 ) ?;
2416 } else {
25- rest = "" ;
17+ write ! ( f , "{c}" ) ? ;
2618 }
2719 }
28- f . write_str ( rest )
20+ Ok ( ( ) )
2921 }
3022}
3123
You can’t perform that action at this time.
0 commit comments