Skip to content

Commit

Permalink
fix up clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jan 28, 2024
1 parent 5e85cb2 commit 580bbbe
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,21 +366,35 @@ fn gen_fn_type_for_trait(

// Function traits cannot support generics in their arguments
// These would require HRTB for types instead of just lifetimes
let mut r: syn::Result<()> = Ok(());
for type_param in sig.generics.type_params() {
return Err(Error::new(
let err = Error::new(
type_param.span(),
format_args!("the trait '{}' cannot be implemented for Fn-traits: generic arguments are not allowed",
trait_def.ident),
));
);

if let Err(ref mut current_err) = r {
current_err.combine(err);
} else {
r = Err(err);
}
}

for const_param in sig.generics.const_params() {
return Err(Error::new(
let err = Error::new(
const_param.span(),
format_args!("the trait '{}' cannot be implemented for Fn-traits: constant arguments are not allowed",
trait_def.ident),
));
);

if let Err(ref mut current_err) = r {
current_err.combine(err);
} else {
r = Err(err);
}
}
r?;

// =======================================================================
// Check if the trait can be implemented for the given proxy type
Expand Down Expand Up @@ -888,7 +902,7 @@ fn should_keep_default_for(m: &TraitItemFn, proxy_type: &ProxyType) -> syn::Resu
.attrs
.iter()
.filter(|attr| is_our_attr(attr))
.map(|attr| parse_our_attr(attr));
.map(parse_our_attr);

// Check the first (and hopefully only) `keep_default_for` attribute.
let out = match it.next() {
Expand Down

0 comments on commit 580bbbe

Please sign in to comment.