mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Enable and fix control flow related clippy lints
This commit is contained in:
@@ -88,13 +88,14 @@ where
|
||||
type Rejection = T::Rejection;
|
||||
|
||||
async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
|
||||
match Extension::<CachedEntry<T>>::from_request_parts(parts, state).await {
|
||||
Ok(Extension(CachedEntry(value))) => Ok(Self(value)),
|
||||
Err(_) => {
|
||||
let value = T::from_request_parts(parts, state).await?;
|
||||
parts.extensions.insert(CachedEntry(value.clone()));
|
||||
Ok(Self(value))
|
||||
}
|
||||
if let Ok(Extension(CachedEntry(value))) =
|
||||
Extension::<CachedEntry<T>>::from_request_parts(parts, state).await
|
||||
{
|
||||
Ok(Self(value))
|
||||
} else {
|
||||
let value = T::from_request_parts(parts, state).await?;
|
||||
parts.extensions.insert(CachedEntry(value.clone()));
|
||||
Ok(Self(value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,21 +183,15 @@ composite_rejection! {
|
||||
}
|
||||
|
||||
fn json_content_type(headers: &HeaderMap) -> bool {
|
||||
let content_type = if let Some(content_type) = headers.get(header::CONTENT_TYPE) {
|
||||
content_type
|
||||
} else {
|
||||
let Some(content_type) = headers.get(header::CONTENT_TYPE) else {
|
||||
return false;
|
||||
};
|
||||
|
||||
let content_type = if let Ok(content_type) = content_type.to_str() {
|
||||
content_type
|
||||
} else {
|
||||
let Ok(content_type) = content_type.to_str() else {
|
||||
return false;
|
||||
};
|
||||
|
||||
let mime = if let Ok(mime) = content_type.parse::<mime::Mime>() {
|
||||
mime
|
||||
} else {
|
||||
let Ok(mime) = content_type.parse::<mime::Mime>() else {
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user