Fix new clippy lints (#3054)

This commit is contained in:
Jonas Platte 2024-11-28 23:53:20 +01:00 committed by GitHub
parent 11806fbc61
commit c7aa6454e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 6 additions and 13 deletions

View file

@ -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
}

View file

@ -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<_>",

View file

@ -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!(

View file

@ -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.

View file

@ -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
}