File tree 2 files changed +6
-14
lines changed
2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change 21
21
pub use self :: levels:: LintSource :: { self , * } ;
22
22
pub use self :: Level :: * ;
23
23
24
- use crate :: ty:: TyCtxt ;
25
24
use rustc_data_structures:: sync;
26
25
use rustc_hir as hir;
27
26
use rustc_session:: lint:: builtin:: HardwiredLints ;
@@ -315,8 +314,3 @@ pub mod internal;
315
314
mod levels;
316
315
317
316
pub use self :: levels:: { struct_lint_level, LintLevelMap , LintLevelSets , LintLevelsBuilder } ;
318
-
319
- pub fn maybe_lint_level_root ( tcx : TyCtxt < ' _ > , id : hir:: HirId ) -> bool {
320
- let attrs = tcx. hir ( ) . attrs ( id) ;
321
- attrs. iter ( ) . any ( |attr| Level :: from_symbol ( attr. name_or_empty ( ) ) . is_some ( ) )
322
- }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use crate::hir::map as hir_map;
8
8
use crate :: hir:: map:: DefPathHash ;
9
9
use crate :: ich:: { NodeIdHashingMode , StableHashingContext } ;
10
10
use crate :: infer:: canonical:: { Canonical , CanonicalVarInfo , CanonicalVarInfos } ;
11
- use crate :: lint:: { maybe_lint_level_root , struct_lint_level, LintSource } ;
11
+ use crate :: lint:: { struct_lint_level, LintSource } ;
12
12
use crate :: middle;
13
13
use crate :: middle:: cstore:: CrateStoreDyn ;
14
14
use crate :: middle:: cstore:: EncodedMetadata ;
@@ -2568,19 +2568,17 @@ impl<'tcx> TyCtxt<'tcx> {
2568
2568
2569
2569
/// Walks upwards from `id` to find a node which might change lint levels with attributes.
2570
2570
/// It stops at `bound` and just returns it if reached.
2571
- pub fn maybe_lint_level_root_bounded (
2572
- self ,
2573
- mut id : hir:: HirId ,
2574
- bound : hir:: HirId ,
2575
- ) -> hir:: HirId {
2571
+ pub fn maybe_lint_level_root_bounded ( self , mut id : HirId , bound : HirId ) -> HirId {
2572
+ let hir = self . hir ( ) ;
2576
2573
loop {
2577
2574
if id == bound {
2578
2575
return bound;
2579
2576
}
2580
- if maybe_lint_level_root ( self , id) {
2577
+
2578
+ if hir. attrs ( id) . iter ( ) . any ( |attr| Level :: from_symbol ( attr. name_or_empty ( ) ) . is_some ( ) ) {
2581
2579
return id;
2582
2580
}
2583
- let next = self . hir ( ) . get_parent_node ( id) ;
2581
+ let next = hir. get_parent_node ( id) ;
2584
2582
if next == id {
2585
2583
bug ! ( "lint traversal reached the root of the crate" ) ;
2586
2584
}
You can’t perform that action at this time.
0 commit comments