mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Fix assorted Clippy lints (#3390)
This commit is contained in:
@@ -530,10 +530,10 @@ fn parse_field(pat_ident: PatIdent, ty: Type, attrs: &[Attribute]) -> syn::Resul
|
||||
})
|
||||
})
|
||||
.transpose()?;
|
||||
if let Some(range) = &number_mode_range {
|
||||
if range.elems.len() != 2 {
|
||||
return Err(Error::new_spanned(range, "Expected a tuple of two values for `range` for the min and max, respectively"));
|
||||
}
|
||||
if let Some(range) = &number_mode_range
|
||||
&& range.elems.len() != 2
|
||||
{
|
||||
return Err(Error::new_spanned(range, "Expected a tuple of two values for `range` for the min and max, respectively"));
|
||||
}
|
||||
|
||||
let unit = extract_attribute(attrs, "unit")
|
||||
@@ -641,20 +641,19 @@ fn parse_field(pat_ident: PatIdent, ty: Type, attrs: &[Attribute]) -> syn::Resul
|
||||
fn parse_node_type(ty: &Type) -> (bool, Option<Type>, Option<Type>) {
|
||||
if let Type::ImplTrait(impl_trait) = ty {
|
||||
for bound in &impl_trait.bounds {
|
||||
if let syn::TypeParamBound::Trait(trait_bound) = bound {
|
||||
if trait_bound.path.segments.last().is_some_and(|seg| seg.ident == "Node") {
|
||||
if let syn::PathArguments::AngleBracketed(args) = &trait_bound.path.segments.last().unwrap().arguments {
|
||||
let input_type = args.args.iter().find_map(|arg| if let syn::GenericArgument::Type(ty) = arg { Some(ty.clone()) } else { None });
|
||||
let output_type = args.args.iter().find_map(|arg| {
|
||||
if let syn::GenericArgument::AssocType(assoc_type) = arg {
|
||||
if assoc_type.ident == "Output" { Some(assoc_type.ty.clone()) } else { None }
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
return (true, input_type, output_type);
|
||||
if let syn::TypeParamBound::Trait(trait_bound) = bound
|
||||
&& trait_bound.path.segments.last().is_some_and(|seg| seg.ident == "Node")
|
||||
&& let syn::PathArguments::AngleBracketed(args) = &trait_bound.path.segments.last().unwrap().arguments
|
||||
{
|
||||
let input_type = args.args.iter().find_map(|arg| if let syn::GenericArgument::Type(ty) = arg { Some(ty.clone()) } else { None });
|
||||
let output_type = args.args.iter().find_map(|arg| {
|
||||
if let syn::GenericArgument::AssocType(assoc_type) = arg {
|
||||
if assoc_type.ident == "Output" { Some(assoc_type.ty.clone()) } else { None }
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
});
|
||||
return (true, input_type, output_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user