11use rustc:: hir:: { self , GenericParamKind , PatKind } ;
22use rustc:: hir:: def:: Def ;
33use rustc:: hir:: intravisit:: FnKind ;
4+ use rustc:: lint;
45use rustc:: ty;
56use rustc_target:: spec:: abi:: Abi ;
67use lint:: { EarlyContext , LateContext , LintContext , LintArray } ;
@@ -17,7 +18,7 @@ pub enum MethodLateContext {
1718 PlainImpl ,
1819}
1920
20- pub fn method_context ( cx : & LateContext , id : ast:: NodeId ) -> MethodLateContext {
21+ pub fn method_context ( cx : & LateContext < ' _ , ' _ > , id : ast:: NodeId ) -> MethodLateContext {
2122 let def_id = cx. tcx . hir ( ) . local_def_id ( id) ;
2223 let item = cx. tcx . associated_item ( def_id) ;
2324 match item. container {
@@ -41,7 +42,7 @@ declare_lint! {
4142pub struct NonCamelCaseTypes ;
4243
4344impl NonCamelCaseTypes {
44- fn check_case ( & self , cx : & EarlyContext , sort : & str , ident : & Ident ) {
45+ fn check_case ( & self , cx : & EarlyContext < ' _ > , sort : & str , ident : & Ident ) {
4546 fn char_has_case ( c : char ) -> bool {
4647 c. is_lowercase ( ) || c. is_uppercase ( )
4748 }
@@ -115,7 +116,7 @@ impl LintPass for NonCamelCaseTypes {
115116}
116117
117118impl EarlyLintPass for NonCamelCaseTypes {
118- fn check_item ( & mut self , cx : & EarlyContext , it : & ast:: Item ) {
119+ fn check_item ( & mut self , cx : & EarlyContext < ' _ > , it : & ast:: Item ) {
119120 let has_repr_c = it. attrs
120121 . iter ( )
121122 . any ( |attr| {
@@ -138,11 +139,11 @@ impl EarlyLintPass for NonCamelCaseTypes {
138139 }
139140 }
140141
141- fn check_variant ( & mut self , cx : & EarlyContext , v : & ast:: Variant , _: & ast:: Generics ) {
142+ fn check_variant ( & mut self , cx : & EarlyContext < ' _ > , v : & ast:: Variant , _: & ast:: Generics ) {
142143 self . check_case ( cx, "variant" , & v. node . ident ) ;
143144 }
144145
145- fn check_generic_param ( & mut self , cx : & EarlyContext , param : & ast:: GenericParam ) {
146+ fn check_generic_param ( & mut self , cx : & EarlyContext < ' _ > , param : & ast:: GenericParam ) {
146147 if let ast:: GenericParamKind :: Type { .. } = param. kind {
147148 self . check_case ( cx, "type parameter" , & param. ident ) ;
148149 }
@@ -190,7 +191,7 @@ impl NonSnakeCase {
190191 }
191192
192193 /// Checks if a given identifier is snake case, and reports a diagnostic if not.
193- fn check_snake_case ( & self , cx : & LateContext , sort : & str , ident : & Ident ) {
194+ fn check_snake_case ( & self , cx : & LateContext < ' _ , ' _ > , sort : & str , ident : & Ident ) {
194195 fn is_snake_case ( ident : & str ) -> bool {
195196 if ident. is_empty ( ) {
196197 return true ;
@@ -249,7 +250,7 @@ impl LintPass for NonSnakeCase {
249250}
250251
251252impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for NonSnakeCase {
252- fn check_crate ( & mut self , cx : & LateContext , cr : & hir:: Crate ) {
253+ fn check_crate ( & mut self , cx : & LateContext < ' _ , ' _ > , cr : & hir:: Crate ) {
253254 let crate_ident = if let Some ( name) = & cx. tcx . sess . opts . crate_name {
254255 Some ( Ident :: from_str ( name) )
255256 } else {
@@ -286,16 +287,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
286287 }
287288 }
288289
289- fn check_generic_param ( & mut self , cx : & LateContext , param : & hir:: GenericParam ) {
290+ fn check_generic_param ( & mut self , cx : & LateContext < ' _ , ' _ > , param : & hir:: GenericParam ) {
290291 if let GenericParamKind :: Lifetime { .. } = param. kind {
291292 self . check_snake_case ( cx, "lifetime" , & param. name . ident ( ) ) ;
292293 }
293294 }
294295
295296 fn check_fn (
296297 & mut self ,
297- cx : & LateContext ,
298- fk : FnKind ,
298+ cx : & LateContext < ' _ , ' _ > ,
299+ fk : FnKind < ' _ > ,
299300 _: & hir:: FnDecl ,
300301 _: & hir:: Body ,
301302 _: Span ,
@@ -324,13 +325,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
324325 }
325326 }
326327
327- fn check_item ( & mut self , cx : & LateContext , it : & hir:: Item ) {
328+ fn check_item ( & mut self , cx : & LateContext < ' _ , ' _ > , it : & hir:: Item ) {
328329 if let hir:: ItemKind :: Mod ( _) = it. node {
329330 self . check_snake_case ( cx, "module" , & it. ident ) ;
330331 }
331332 }
332333
333- fn check_trait_item ( & mut self , cx : & LateContext , item : & hir:: TraitItem ) {
334+ fn check_trait_item ( & mut self , cx : & LateContext < ' _ , ' _ > , item : & hir:: TraitItem ) {
334335 if let hir:: TraitItemKind :: Method ( _, hir:: TraitMethod :: Required ( pnames) ) = & item. node {
335336 self . check_snake_case ( cx, "trait method" , & item. ident ) ;
336337 for param_name in pnames {
@@ -339,15 +340,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
339340 }
340341 }
341342
342- fn check_pat ( & mut self , cx : & LateContext , p : & hir:: Pat ) {
343+ fn check_pat ( & mut self , cx : & LateContext < ' _ , ' _ > , p : & hir:: Pat ) {
343344 if let & PatKind :: Binding ( _, _, _, ident, _) = & p. node {
344345 self . check_snake_case ( cx, "variable" , & ident) ;
345346 }
346347 }
347348
348349 fn check_struct_def (
349350 & mut self ,
350- cx : & LateContext ,
351+ cx : & LateContext < ' _ , ' _ > ,
351352 s : & hir:: VariantData ,
352353 _: ast:: Name ,
353354 _: & hir:: Generics ,
@@ -369,7 +370,7 @@ declare_lint! {
369370pub struct NonUpperCaseGlobals ;
370371
371372impl NonUpperCaseGlobals {
372- fn check_upper_case ( cx : & LateContext , sort : & str , ident : & Ident ) {
373+ fn check_upper_case ( cx : & LateContext < ' _ , ' _ > , sort : & str , ident : & Ident ) {
373374 let name = & ident. name . as_str ( ) ;
374375
375376 if name. chars ( ) . any ( |c| c. is_lowercase ( ) ) {
@@ -399,7 +400,7 @@ impl LintPass for NonUpperCaseGlobals {
399400}
400401
401402impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for NonUpperCaseGlobals {
402- fn check_item ( & mut self , cx : & LateContext , it : & hir:: Item ) {
403+ fn check_item ( & mut self , cx : & LateContext < ' _ , ' _ > , it : & hir:: Item ) {
403404 match it. node {
404405 hir:: ItemKind :: Static ( ..) if !attr:: contains_name ( & it. attrs , "no_mangle" ) => {
405406 NonUpperCaseGlobals :: check_upper_case ( cx, "static variable" , & it. ident ) ;
@@ -411,19 +412,19 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
411412 }
412413 }
413414
414- fn check_trait_item ( & mut self , cx : & LateContext , ti : & hir:: TraitItem ) {
415+ fn check_trait_item ( & mut self , cx : & LateContext < ' _ , ' _ > , ti : & hir:: TraitItem ) {
415416 if let hir:: TraitItemKind :: Const ( ..) = ti. node {
416417 NonUpperCaseGlobals :: check_upper_case ( cx, "associated constant" , & ti. ident ) ;
417418 }
418419 }
419420
420- fn check_impl_item ( & mut self , cx : & LateContext , ii : & hir:: ImplItem ) {
421+ fn check_impl_item ( & mut self , cx : & LateContext < ' _ , ' _ > , ii : & hir:: ImplItem ) {
421422 if let hir:: ImplItemKind :: Const ( ..) = ii. node {
422423 NonUpperCaseGlobals :: check_upper_case ( cx, "associated constant" , & ii. ident ) ;
423424 }
424425 }
425426
426- fn check_pat ( & mut self , cx : & LateContext , p : & hir:: Pat ) {
427+ fn check_pat ( & mut self , cx : & LateContext < ' _ , ' _ > , p : & hir:: Pat ) {
427428 // Lint for constants that look like binding identifiers (#7526)
428429 if let PatKind :: Path ( hir:: QPath :: Resolved ( None , ref path) ) = p. node {
429430 if let Def :: Const ( ..) = path. def {
0 commit comments