@@ -283,7 +283,7 @@ impl Body {
283
283
pub async fn into_json < T : DeserializeOwned > ( mut self ) -> crate :: Result < T > {
284
284
let mut buf = Vec :: with_capacity ( 1024 ) ;
285
285
self . read_to_end ( & mut buf) . await ?;
286
- Ok ( serde_json:: from_slice ( & buf) . status ( StatusCode :: UnprocessableEntity ) ? )
286
+ serde_json:: from_slice ( & buf) . status ( StatusCode :: UnprocessableEntity )
287
287
}
288
288
289
289
/// Creates a `Body` from a type, serializing it using form encoding.
@@ -356,7 +356,7 @@ impl Body {
356
356
#[ cfg( feature = "serde" ) ]
357
357
pub async fn into_form < T : DeserializeOwned > ( self ) -> crate :: Result < T > {
358
358
let s = self . into_string ( ) . await ?;
359
- Ok ( serde_urlencoded:: from_str ( & s) . status ( StatusCode :: UnprocessableEntity ) ? )
359
+ serde_urlencoded:: from_str ( & s) . status ( StatusCode :: UnprocessableEntity )
360
360
}
361
361
362
362
/// Create a `Body` from a file named by a path.
@@ -630,7 +630,7 @@ async fn peek_mime(file: &mut async_std::fs::File) -> io::Result<Option<Mime>> {
630
630
/// This is useful for plain-text formats such as HTML and CSS.
631
631
#[ cfg( all( feature = "fs" , not( target_os = "unknown" ) ) ) ]
632
632
fn guess_ext ( path : & std:: path:: Path ) -> Option < Mime > {
633
- let ext = path. extension ( ) . map ( |p| p. to_str ( ) ) . flatten ( ) ;
633
+ let ext = path. extension ( ) . and_then ( |p| p. to_str ( ) ) ;
634
634
ext. and_then ( Mime :: from_extension)
635
635
}
636
636
0 commit comments