- generics.params.iter().for_each(|param| match param.kind {
- GenericParamKind::Lifetime { .. } => {},
- GenericParamKind::Type { .. } => {
- for bound in ¶m.bounds {
- let mut visitor = RefVisitor::new(cx);
- walk_param_bound(&mut visitor, bound);
- if visitor.lts.iter().any(|lt| matches!(lt, RefLt::Named(_))) {
- return;
- }
- if let GenericBound::Trait(ref trait_ref, _) = *bound {
- let params = &trait_ref
- .trait_ref
- .path
- .segments
- .last()
- .expect("a path must have at least one segment")
- .args;
- if let Some(ref params) = *params {
- for bound in ¶ms.lifetimes {
- if bound.name.name() != "'static" && !bound.is_elided() {
- return;
- }
- bounds_lts.push(bound);
+ let types = generics.params.iter().filter(|param| match param.kind {
+ GenericParamKind::Type { .. } => true,
+ GenericParamKind::Lifetime { .. } => false,
+ });
+ for typ in types {
+ for bound in &typ.bounds {
+ let mut visitor = RefVisitor::new(cx);
+ walk_param_bound(&mut visitor, bound);
+ if visitor.lts.iter().any(|lt| matches!(lt, RefLt::Named(_))) {
+ return;
+ }
+ if let GenericBound::Trait(ref trait_ref, _) = *bound {
+ let params = &trait_ref
+ .trait_ref
+ .path
+ .segments
+ .last()
+ .expect("a path must have at least one segment")
+ .args;
+ if let Some(ref params) = *params {
+ let lifetimes = params.args.iter().filter_map(|arg| match arg {
+ GenericArg::Lifetime(lt) => Some(lt),
+ GenericArg::Type(_) => None,
+ });
+ for bound in lifetimes {
+ if bound.name != LifetimeName::Static && !bound.is_elided() {
+ return;