@@ -507,7 +507,7 @@ impl AsyncRead for Body {
507
507
cx : & mut Context < ' _ > ,
508
508
buf : & mut [ u8 ] ,
509
509
) -> Poll < io:: Result < usize > > {
510
- let mut buf = match self . length {
510
+ let buf = match self . length {
511
511
None => buf,
512
512
Some ( length) if length == self . bytes_read => return Poll :: Ready ( Ok ( 0 ) ) ,
513
513
Some ( length) => {
@@ -516,7 +516,7 @@ impl AsyncRead for Body {
516
516
}
517
517
} ;
518
518
519
- let bytes = ready ! ( Pin :: new( & mut self . reader) . poll_read( cx, & mut buf) ) ?;
519
+ let bytes = ready ! ( Pin :: new( & mut self . reader) . poll_read( cx, buf) ) ?;
520
520
self . bytes_read += bytes;
521
521
Poll :: Ready ( Ok ( bytes) )
522
522
}
@@ -551,7 +551,7 @@ async fn peek_mime(file: &mut async_std::fs::File) -> io::Result<Option<Mime>> {
551
551
/// This is useful for plain-text formats such as HTML and CSS.
552
552
#[ cfg( all( feature = "fs" , not( target_os = "unknown" ) ) ) ]
553
553
fn guess_ext ( path : & std:: path:: Path ) -> Option < Mime > {
554
- let ext = path. extension ( ) . map ( |p| p. to_str ( ) ) . flatten ( ) ;
554
+ let ext = path. extension ( ) . and_then ( |p| p. to_str ( ) ) ;
555
555
ext. and_then ( Mime :: from_extension)
556
556
}
557
557
@@ -565,7 +565,7 @@ mod test {
565
565
async fn json_status ( ) {
566
566
#[ derive( Debug , Deserialize ) ]
567
567
struct Foo {
568
- inner : String ,
568
+ _inner : String ,
569
569
}
570
570
let body = Body :: empty ( ) ;
571
571
let res = body. into_json :: < Foo > ( ) . await ;
@@ -576,7 +576,7 @@ mod test {
576
576
async fn form_status ( ) {
577
577
#[ derive( Debug , Deserialize ) ]
578
578
struct Foo {
579
- inner : String ,
579
+ _inner : String ,
580
580
}
581
581
let body = Body :: empty ( ) ;
582
582
let res = body. into_form :: < Foo > ( ) . await ;
0 commit comments