@@ -10,16 +10,16 @@ use std::collections::hash_map::Entry;
10
10
use rustc_ast:: token:: TokenKind ;
11
11
use rustc_ast:: tokenstream:: TokenTree ;
12
12
use rustc_ast:: {
13
- ast , AttrKind , AttrStyle , Attribute , LitKind , MetaItemInner , MetaItemKind , MetaItemLit ,
13
+ AttrKind , AttrStyle , Attribute , LitKind , MetaItemInner , MetaItemKind , MetaItemLit , ast ,
14
14
} ;
15
15
use rustc_data_structures:: fx:: FxHashMap ;
16
16
use 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 } ;
18
18
use rustc_hir:: def_id:: LocalModDefId ;
19
19
use rustc_hir:: intravisit:: { self , Visitor } ;
20
20
use rustc_hir:: {
21
- self as hir, self , FnSig , ForeignItem , HirId , Item , ItemKind , MethodKind , Safety , Target ,
22
- TraitItem , CRATE_HIR_ID , CRATE_OWNER_ID ,
21
+ self as hir, self , CRATE_HIR_ID , CRATE_OWNER_ID , FnSig , ForeignItem , HirId , Item , ItemKind ,
22
+ MethodKind , Safety , Target , TraitItem ,
23
23
} ;
24
24
use rustc_macros:: LintDiagnostic ;
25
25
use rustc_middle:: hir:: nested_filter;
@@ -34,8 +34,8 @@ use rustc_session::lint::builtin::{
34
34
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES , UNUSED_ATTRIBUTES ,
35
35
} ;
36
36
use 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 } ;
39
39
use rustc_target:: abi:: Size ;
40
40
use rustc_target:: spec:: abi:: Abi ;
41
41
use rustc_trait_selection:: error_reporting:: InferCtxtErrorExt ;
@@ -349,12 +349,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
349
349
}
350
350
351
351
fn inline_attr_str_error_without_macro_def ( & self , hir_id : HirId , attr : & Attribute , sym : & str ) {
352
- self . tcx . emit_node_span_lint (
353
- UNUSED_ATTRIBUTES ,
354
- hir_id,
355
- attr. span ,
356
- errors:: IgnoredAttr { sym } ,
357
- ) ;
352
+ self . tcx
353
+ . emit_node_span_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: IgnoredAttr { sym } ) ;
358
354
}
359
355
360
356
/// Checks if `#[diagnostic::do_not_recommend]` is applied on a trait impl.
@@ -1398,12 +1394,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1398
1394
_ => {
1399
1395
// FIXME: #[cold] was previously allowed on non-functions and some crates used
1400
1396
// this, so only emit a warning.
1401
- self . tcx . emit_node_span_lint (
1402
- UNUSED_ATTRIBUTES ,
1403
- hir_id,
1404
- attr. span ,
1405
- errors:: Cold { span, on_crate : hir_id == CRATE_HIR_ID } ,
1406
- ) ;
1397
+ self . tcx . emit_node_span_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: Cold {
1398
+ span,
1399
+ on_crate : hir_id == CRATE_HIR_ID ,
1400
+ } ) ;
1407
1401
}
1408
1402
}
1409
1403
}
@@ -1418,12 +1412,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1418
1412
return ;
1419
1413
}
1420
1414
1421
- self . tcx . emit_node_span_lint (
1422
- UNUSED_ATTRIBUTES ,
1423
- hir_id,
1424
- attr. span ,
1425
- errors:: Link { span : ( target != Target :: ForeignMod ) . then_some ( span) } ,
1426
- ) ;
1415
+ self . tcx . emit_node_span_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: Link {
1416
+ span : ( target != Target :: ForeignMod ) . then_some ( span) ,
1417
+ } ) ;
1427
1418
}
1428
1419
1429
1420
/// Checks if `#[link_name]` is applied to an item other than a foreign function or static.
@@ -1893,11 +1884,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1893
1884
|| ( int_reprs == 1
1894
1885
&& is_c
1895
1886
&& item. is_some_and ( |item| {
1896
- if let ItemLike :: Item ( item) = item {
1897
- is_c_like_enum ( item)
1898
- } else {
1899
- false
1900
- }
1887
+ if let ItemLike :: Item ( item) = item { is_c_like_enum ( item) } else { false }
1901
1888
} ) )
1902
1889
{
1903
1890
self . tcx . emit_node_span_lint (
@@ -2237,12 +2224,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2237
2224
return ;
2238
2225
} ;
2239
2226
2240
- self . tcx . emit_node_span_lint (
2241
- UNUSED_ATTRIBUTES ,
2242
- hir_id,
2243
- attr. span ,
2244
- errors:: Unused { attr_span : attr. span , note } ,
2245
- ) ;
2227
+ self . tcx . emit_node_span_lint ( UNUSED_ATTRIBUTES , hir_id, attr. span , errors:: Unused {
2228
+ attr_span : attr. span ,
2229
+ note,
2230
+ } ) ;
2246
2231
}
2247
2232
2248
2233
/// A best effort attempt to create an error for a mismatching proc macro signature.
0 commit comments