mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-04 14:04:41 +01:00
Fix new clippy lints (#3054)
This commit is contained in:
parent
11806fbc61
commit
c7aa6454e7
5 changed files with 6 additions and 13 deletions
|
@ -202,7 +202,7 @@ fn json_content_type(headers: &HeaderMap) -> bool {
|
|||
};
|
||||
|
||||
let is_json_content_type = mime.type_() == "application"
|
||||
&& (mime.subtype() == "json" || mime.suffix().map_or(false, |name| name == "json"));
|
||||
&& (mime.subtype() == "json" || mime.suffix().is_some_and(|name| name == "json"));
|
||||
|
||||
is_json_content_type
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ fn check_inputs_impls_from_request(
|
|||
state_ty: Type,
|
||||
kind: FunctionKind,
|
||||
) -> TokenStream {
|
||||
let takes_self = item_fn.sig.inputs.first().map_or(false, |arg| match arg {
|
||||
let takes_self = item_fn.sig.inputs.first().is_some_and(|arg| match arg {
|
||||
FnArg::Receiver(_) => true,
|
||||
FnArg::Typed(typed) => is_self_pat_type(typed),
|
||||
});
|
||||
|
@ -604,10 +604,7 @@ fn request_consuming_type_name(ty: &Type) -> Option<&'static str> {
|
|||
}
|
||||
|
||||
fn well_known_last_response_type(ty: &Type) -> Option<&'static str> {
|
||||
let typename = match extract_clean_typename(ty) {
|
||||
Some(tn) => tn,
|
||||
None => return None,
|
||||
};
|
||||
let typename = extract_clean_typename(ty)?;
|
||||
|
||||
let type_name = match &*typename {
|
||||
"Json" => "Json<_>",
|
||||
|
|
|
@ -290,11 +290,7 @@ fn parse_single_generic_type_on_struct(
|
|||
let field = fields_unnamed.unnamed.first().unwrap();
|
||||
|
||||
if let syn::Type::Path(type_path) = &field.ty {
|
||||
if type_path
|
||||
.path
|
||||
.get_ident()
|
||||
.map_or(true, |field_type_ident| field_type_ident != ty_ident)
|
||||
{
|
||||
if type_path.path.get_ident() != Some(ty_ident) {
|
||||
return Err(syn::Error::new_spanned(
|
||||
type_path,
|
||||
format_args!(
|
||||
|
|
|
@ -117,7 +117,7 @@ impl Stream for Field<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Field<'a> {
|
||||
impl Field<'_> {
|
||||
/// The field name found in the
|
||||
/// [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition)
|
||||
/// header.
|
||||
|
|
|
@ -132,7 +132,7 @@ fn json_content_type(headers: &HeaderMap) -> bool {
|
|||
};
|
||||
|
||||
let is_json_content_type = mime.type_() == "application"
|
||||
&& (mime.subtype() == "json" || mime.suffix().map_or(false, |name| name == "json"));
|
||||
&& (mime.subtype() == "json" || mime.suffix().is_some_and(|name| name == "json"));
|
||||
|
||||
is_json_content_type
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue