@@ -215,14 +215,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
215
215
} ,
216
216
_ => { } ,
217
217
}
218
- if items. is_empty ( ) || attr. name ( ) != "deprecated" {
218
+ if items. is_empty ( ) || ! attr. check_name ( "deprecated" ) {
219
219
return ;
220
220
}
221
221
for item in items {
222
222
if_chain ! {
223
223
if let NestedMetaItem :: MetaItem ( mi) = & item;
224
224
if let MetaItemKind :: NameValue ( lit) = & mi. node;
225
- if mi. name ( ) == "since" ;
225
+ if mi. check_name ( "since" ) ;
226
226
then {
227
227
check_semver( cx, item. span( ) , lit) ;
228
228
}
@@ -238,7 +238,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
238
238
}
239
239
match item. node {
240
240
ItemKind :: ExternCrate ( ..) | ItemKind :: Use ( ..) => {
241
- let skip_unused_imports = item. attrs . iter ( ) . any ( |attr| attr. name ( ) == "macro_use" ) ;
241
+ let skip_unused_imports = item. attrs . iter ( ) . any ( |attr| attr. check_name ( "macro_use" ) ) ;
242
242
243
243
for attr in & item. attrs {
244
244
if let Some ( lint_list) = & attr. meta_item_list ( ) {
@@ -447,7 +447,7 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
447
447
}
448
448
449
449
if let Some ( values) = attr. meta_item_list ( ) {
450
- if values. len ( ) != 1 || attr. name ( ) != "inline" {
450
+ if values. len ( ) != 1 || ! attr. check_name ( "inline" ) {
451
451
continue ;
452
452
}
453
453
if is_word ( & values[ 0 ] , "always" ) {
@@ -481,7 +481,7 @@ fn check_semver(cx: &LateContext<'_, '_>, span: Span, lit: &Lit) {
481
481
482
482
fn is_word ( nmi : & NestedMetaItem , expected : & str ) -> bool {
483
483
if let NestedMetaItem :: MetaItem ( mi) = & nmi {
484
- mi. is_word ( ) && mi. name ( ) == expected
484
+ mi. is_word ( ) && mi. check_name ( expected)
485
485
} else {
486
486
false
487
487
}
@@ -518,15 +518,15 @@ impl EarlyLintPass for CfgAttrPass {
518
518
fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & Attribute ) {
519
519
if_chain ! {
520
520
// check cfg_attr
521
- if attr. name ( ) == "cfg_attr" ;
521
+ if attr. check_name ( "cfg_attr" ) ;
522
522
if let Some ( items) = attr. meta_item_list( ) ;
523
523
if items. len( ) == 2 ;
524
524
// check for `rustfmt`
525
525
if let Some ( feature_item) = items[ 0 ] . meta_item( ) ;
526
- if feature_item. name ( ) == "rustfmt" ;
526
+ if feature_item. check_name ( "rustfmt" ) ;
527
527
// check for `rustfmt_skip` and `rustfmt::skip`
528
528
if let Some ( skip_item) = & items[ 1 ] . meta_item( ) ;
529
- if skip_item. name ( ) == "rustfmt_skip" || skip_item. name ( ) == "skip" ;
529
+ if skip_item. check_name ( "rustfmt_skip" ) || skip_item. check_name ( "skip" ) ;
530
530
// Only lint outer attributes, because custom inner attributes are unstable
531
531
// Tracking issue: https://github.com/rust-lang/rust/issues/54726
532
532
if let AttrStyle :: Outer = attr. style;
0 commit comments