@@ -10,16 +10,16 @@ use std::collections::hash_map::Entry;
1010use rustc_ast:: token:: TokenKind ;
1111use rustc_ast:: tokenstream:: TokenTree ;
1212use rustc_ast:: {
13- ast , AttrKind , AttrStyle , Attribute , LitKind , MetaItemInner , MetaItemKind , MetaItemLit ,
13+ AttrKind , AttrStyle , Attribute , LitKind , MetaItemInner , MetaItemKind , MetaItemLit , ast ,
1414} ;
1515use rustc_data_structures:: fx:: FxHashMap ;
1616use rustc_errors:: { Applicability , DiagCtxtHandle , IntoDiagArg , MultiSpan , StashKey } ;
17- use rustc_feature:: { AttributeDuplicates , AttributeType , BuiltinAttribute , BUILTIN_ATTRIBUTE_MAP } ;
17+ use rustc_feature:: { AttributeDuplicates , AttributeType , BUILTIN_ATTRIBUTE_MAP , BuiltinAttribute } ;
1818use rustc_hir:: def_id:: LocalModDefId ;
1919use rustc_hir:: intravisit:: { self , Visitor } ;
2020use rustc_hir:: {
21- self , self as hir, AssocItemKind , FnSig , FnSig , ForeignItem , ForeignItem , HirId , Item ,
22- ItemKind , MethodKind , Safety , Target , Target , TraitItem , CRATE_HIR_ID , CRATE_OWNER_ID ,
21+ self , self as hir, AssocItemKind , CRATE_HIR_ID , CRATE_OWNER_ID , FnSig , ForeignItem , HirId ,
22+ Item , ItemKind , MethodKind , Safety , Target , TraitItem ,
2323} ;
2424use rustc_macros:: LintDiagnostic ;
2525use rustc_middle:: hir:: nested_filter;
@@ -34,8 +34,8 @@ use rustc_session::lint::builtin::{
3434 UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES , UNUSED_ATTRIBUTES ,
3535} ;
3636use rustc_session:: parse:: feature_err;
37- use rustc_span:: symbol:: { kw , sym , Symbol } ;
38- use rustc_span:: { BytePos , Span , DUMMY_SP } ;
37+ use rustc_span:: symbol:: { Symbol , kw , sym } ;
38+ use rustc_span:: { BytePos , DUMMY_SP , Span } ;
3939use rustc_target:: abi:: Size ;
4040use rustc_target:: spec:: abi:: Abi ;
4141use rustc_trait_selection:: error_reporting:: InferCtxtErrorExt ;
@@ -352,12 +352,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
352352 }
353353
354354 fn inline_attr_str_error_without_macro_def ( & self , hir_id : HirId , attr : & Attribute , sym : & str ) {
355- self . tcx . emit_node_span_lint (
356- UNUSED_ATTRIBUTES ,
357- hir_id,
358- attr. span ,
359- errors:: IgnoredAttr { sym } ,
360- ) ;
355+ self . tcx
356+ . emit_node_span_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: IgnoredAttr { sym } ) ;
361357 }
362358
363359 /// Checks if `#[diagnostic::do_not_recommend]` is applied on a trait impl.
@@ -1424,12 +1420,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
14241420 _ => {
14251421 // FIXME: #[cold] was previously allowed on non-functions and some crates used
14261422 // this, so only emit a warning.
1427- self . tcx . emit_node_span_lint (
1428- UNUSED_ATTRIBUTES ,
1429- hir_id,
1430- attr. span ,
1431- errors:: Cold { span, on_crate : hir_id == CRATE_HIR_ID } ,
1432- ) ;
1423+ self . tcx . emit_node_span_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: Cold {
1424+ span,
1425+ on_crate : hir_id == CRATE_HIR_ID ,
1426+ } ) ;
14331427 }
14341428 }
14351429 }
@@ -1444,12 +1438,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
14441438 return ;
14451439 }
14461440
1447- self . tcx . emit_node_span_lint (
1448- UNUSED_ATTRIBUTES ,
1449- hir_id,
1450- attr. span ,
1451- errors:: Link { span : ( target != Target :: ForeignMod ) . then_some ( span) } ,
1452- ) ;
1441+ self . tcx . emit_node_span_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: Link {
1442+ span : ( target != Target :: ForeignMod ) . then_some ( span) ,
1443+ } ) ;
14531444 }
14541445
14551446 /// Checks if `#[link_name]` is applied to an item other than a foreign function or static.
@@ -1919,11 +1910,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
19191910 || ( int_reprs == 1
19201911 && is_c
19211912 && item. is_some_and ( |item| {
1922- if let ItemLike :: Item ( item) = item {
1923- is_c_like_enum ( item)
1924- } else {
1925- false
1926- }
1913+ if let ItemLike :: Item ( item) = item { is_c_like_enum ( item) } else { false }
19271914 } ) )
19281915 {
19291916 self . tcx . emit_node_span_lint (
@@ -2263,12 +2250,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
22632250 return ;
22642251 } ;
22652252
2266- self . tcx . emit_node_span_lint (
2267- UNUSED_ATTRIBUTES ,
2268- hir_id,
2269- attr. span ,
2270- errors:: Unused { attr_span : attr. span , note } ,
2271- ) ;
2253+ self . tcx . emit_node_span_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: Unused {
2254+ attr_span : attr. span ,
2255+ note,
2256+ } ) ;
22722257 }
22732258
22742259 /// A best effort attempt to create an error for a mismatching proc macro signature.
0 commit comments