diff --git a/axum-extra/src/extract/with_rejection.rs b/axum-extra/src/extract/with_rejection.rs index 0b20641f..586afa5f 100644 --- a/axum-extra/src/extract/with_rejection.rs +++ b/axum-extra/src/extract/with_rejection.rs @@ -37,9 +37,7 @@ where type Rejection = R; async fn from_request(req: &mut RequestParts) -> Result { - match req.extract::().await { - Ok(extractor) => Ok(WithRejection(extractor, PhantomData)), - Err(err) => Err(err.into()), - } + let extractor = req.extract::().await?; + Ok(WithRejection(extractor, PhantomData)) } }