@@ -101,38 +101,40 @@ fn check_fn_inner<'a, 'tcx>(
101
101
}
102
102
103
103
let mut bounds_lts = Vec :: new ( ) ;
104
- generics. params . iter ( ) . for_each ( |param| match param. kind {
105
- GenericParamKind :: Lifetime { .. } => { } ,
106
- GenericParamKind :: Type { .. } => {
107
- for bound in & param. bounds {
108
- let mut visitor = RefVisitor :: new ( cx) ;
109
- walk_param_bound ( & mut visitor, bound) ;
110
- if visitor. lts . iter ( ) . any ( |lt| matches ! ( lt, RefLt :: Named ( _) ) ) {
111
- return ;
112
- }
113
- if let GenericBound :: Trait ( ref trait_ref, _) = * bound {
114
- let params = & trait_ref
115
- . trait_ref
116
- . path
117
- . segments
118
- . last ( )
119
- . expect ( "a path must have at least one segment" )
120
- . args ;
121
- if let Some ( ref params) = * params {
122
- params. args . iter ( ) . for_each ( |param| match param {
123
- GenericArg :: Lifetime ( bound) => {
124
- if bound. name . name ( ) != "'static" && !bound. is_elided ( ) {
125
- return ;
126
- }
127
- bounds_lts. push ( bound) ;
128
- } ,
129
- _ => { } ,
130
- } ) ;
104
+ let types = generics. params . iter ( ) . filter_map ( |param| match param. kind {
105
+ GenericParamKind :: Type { .. } => Some ( param) ,
106
+ GenericParamKind :: Lifetime { .. } => None ,
107
+ } ) ;
108
+ for typ in types {
109
+ for bound in & typ. bounds {
110
+ let mut visitor = RefVisitor :: new ( cx) ;
111
+ walk_param_bound ( & mut visitor, bound) ;
112
+ if visitor. lts . iter ( ) . any ( |lt| matches ! ( lt, RefLt :: Named ( _) ) ) {
113
+ return ;
114
+ }
115
+ if let GenericBound :: Trait ( ref trait_ref, _) = * bound {
116
+ let params = & trait_ref
117
+ . trait_ref
118
+ . path
119
+ . segments
120
+ . last ( )
121
+ . expect ( "a path must have at least one segment" )
122
+ . args ;
123
+ if let Some ( ref params) = * params {
124
+ let lifetimes = params. args . iter ( ) . filter_map ( |arg| match arg {
125
+ GenericArg :: Lifetime ( lt) => Some ( lt) ,
126
+ GenericArg :: Type ( _) => None ,
127
+ } ) ;
128
+ for bound in lifetimes {
129
+ if bound. name . name ( ) != "'static" && !bound. is_elided ( ) {
130
+ return ;
131
+ }
132
+ bounds_lts. push ( bound) ;
131
133
}
132
134
}
133
135
}
134
- } ,
135
- } ) ;
136
+ }
137
+ }
136
138
if could_use_elision ( cx, decl, body, & generics. params , bounds_lts) {
137
139
span_lint (
138
140
cx,
0 commit comments