@@ -16,6 +16,7 @@ use rustc_middle::lint::in_external_macro;
16
16
use rustc_middle:: ty;
17
17
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
18
18
use rustc_span:: source_map:: Span ;
19
+ use rustc_span:: sym;
19
20
use rustc_span:: symbol:: { Symbol , SymbolStr } ;
20
21
use semver:: Version ;
21
22
@@ -286,14 +287,14 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
286
287
} ,
287
288
_ => { } ,
288
289
}
289
- if items. is_empty ( ) || !attr. has_name ( sym ! ( deprecated) ) {
290
+ if items. is_empty ( ) || !attr. has_name ( sym:: deprecated) {
290
291
return ;
291
292
}
292
293
for item in items {
293
294
if_chain ! {
294
295
if let NestedMetaItem :: MetaItem ( mi) = & item;
295
296
if let MetaItemKind :: NameValue ( lit) = & mi. kind;
296
- if mi. has_name( sym! ( since) ) ;
297
+ if mi. has_name( sym:: since) ;
297
298
then {
298
299
check_semver( cx, item. span( ) , lit) ;
299
300
}
@@ -309,7 +310,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
309
310
}
310
311
match item. kind {
311
312
ItemKind :: ExternCrate ( ..) | ItemKind :: Use ( ..) => {
312
- let skip_unused_imports = item. attrs . iter ( ) . any ( |attr| attr. has_name ( sym ! ( macro_use) ) ) ;
313
+ let skip_unused_imports = item. attrs . iter ( ) . any ( |attr| attr. has_name ( sym:: macro_use) ) ;
313
314
314
315
for attr in item. attrs {
315
316
if in_external_macro ( cx. sess ( ) , attr. span ) {
@@ -326,7 +327,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
326
327
match item. kind {
327
328
ItemKind :: Use ( ..) => {
328
329
if is_word ( lint, sym ! ( unused_imports) )
329
- || is_word ( lint, sym ! ( deprecated) )
330
+ || is_word ( lint, sym:: deprecated)
330
331
|| is_word ( lint, sym ! ( unreachable_pub) )
331
332
|| is_word ( lint, sym ! ( unused) )
332
333
|| extract_clippy_lint ( lint)
@@ -411,8 +412,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_>, ident: &str, items: &[NestedMet
411
412
let lint_store = cx. lints ( ) ;
412
413
for lint in items {
413
414
if let Some ( lint_name) = extract_clippy_lint ( lint) {
414
- if let CheckLintNameResult :: Tool ( Err ( ( None , _) ) ) =
415
- lint_store. check_lint_name ( & lint_name, Some ( sym ! ( clippy) ) )
415
+ if let CheckLintNameResult :: Tool ( Err ( ( None , _) ) ) = lint_store. check_lint_name ( & lint_name, Some ( sym:: clippy) )
416
416
{
417
417
span_lint_and_then (
418
418
cx,
@@ -529,10 +529,10 @@ fn check_attrs(cx: &LateContext<'_>, span: Span, name: Symbol, attrs: &[Attribut
529
529
530
530
for attr in attrs {
531
531
if let Some ( values) = attr. meta_item_list ( ) {
532
- if values. len ( ) != 1 || !attr. has_name ( sym ! ( inline) ) {
532
+ if values. len ( ) != 1 || !attr. has_name ( sym:: inline) {
533
533
continue ;
534
534
}
535
- if is_word ( & values[ 0 ] , sym ! ( always) ) {
535
+ if is_word ( & values[ 0 ] , sym:: always) {
536
536
span_lint (
537
537
cx,
538
538
INLINE_ALWAYS ,
@@ -623,12 +623,12 @@ fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::It
623
623
fn check_deprecated_cfg_attr ( cx : & EarlyContext < ' _ > , attr : & Attribute ) {
624
624
if_chain ! {
625
625
// check cfg_attr
626
- if attr. has_name( sym! ( cfg_attr) ) ;
626
+ if attr. has_name( sym:: cfg_attr) ;
627
627
if let Some ( items) = attr. meta_item_list( ) ;
628
628
if items. len( ) == 2 ;
629
629
// check for `rustfmt`
630
630
if let Some ( feature_item) = items[ 0 ] . meta_item( ) ;
631
- if feature_item. has_name( sym! ( rustfmt) ) ;
631
+ if feature_item. has_name( sym:: rustfmt) ;
632
632
// check for `rustfmt_skip` and `rustfmt::skip`
633
633
if let Some ( skip_item) = & items[ 1 ] . meta_item( ) ;
634
634
if skip_item. has_name( sym!( rustfmt_skip) ) ||
@@ -690,7 +690,7 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
690
690
}
691
691
692
692
if_chain ! {
693
- if attr. has_name( sym! ( cfg) ) ;
693
+ if attr. has_name( sym:: cfg) ;
694
694
if let Some ( list) = attr. meta_item_list( ) ;
695
695
let mismatched = find_mismatched_target_os( & list) ;
696
696
if !mismatched. is_empty( ) ;
0 commit comments