File tree 4 files changed +15
-17
lines changed
4 files changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,14 @@ impl ClientCodec {
53
53
}
54
54
if self . escape_count == 3 {
55
55
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 ?;
57
58
buf. write_all ( b"." ) . await ?;
58
59
start = idx;
59
60
}
60
61
}
61
- buf. write_all ( & frame[ start..] ) . await ?;
62
+ buf. write_all ( frame. get ( start..) . unwrap_or_default ( ) )
63
+ . await ?;
62
64
Ok ( ( ) )
63
65
}
64
66
}
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ impl ServerInfo {
144
144
features. insert ( Extension :: StartTls ) ;
145
145
}
146
146
Some ( "AUTH" ) => {
147
- for & mechanism in & split[ 1 .. ] {
147
+ for & mechanism in split. iter ( ) . skip ( 1 ) {
148
148
match mechanism {
149
149
"PLAIN" => {
150
150
features. insert ( Extension :: Authentication ( Mechanism :: Plain ) ) ;
Original file line number Diff line number Diff line change 21
21
unused_import_braces,
22
22
missing_debug_implementations,
23
23
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
25
29
) ]
26
30
27
31
#[ 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);
10
10
11
11
impl Display for XText < ' _ > {
12
12
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 ) ?;
24
16
} else {
25
- rest = "" ;
17
+ write ! ( f , "{c}" ) ? ;
26
18
}
27
19
}
28
- f . write_str ( rest )
20
+ Ok ( ( ) )
29
21
}
30
22
}
31
23
You can’t perform that action at this time.
0 commit comments