File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change 2121pub use self :: levels:: LintSource :: { self , * } ;
2222pub use self :: Level :: * ;
2323
24- use crate :: ty:: TyCtxt ;
2524use rustc_data_structures:: sync;
2625use rustc_hir as hir;
2726use rustc_session:: lint:: builtin:: HardwiredLints ;
@@ -315,8 +314,3 @@ pub mod internal;
315314mod levels;
316315
317316pub 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;
88use crate :: hir:: map:: DefPathHash ;
99use crate :: ich:: { NodeIdHashingMode , StableHashingContext } ;
1010use 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 } ;
1212use crate :: middle;
1313use crate :: middle:: cstore:: CrateStoreDyn ;
1414use crate :: middle:: cstore:: EncodedMetadata ;
@@ -2568,19 +2568,17 @@ impl<'tcx> TyCtxt<'tcx> {
25682568
25692569 /// Walks upwards from `id` to find a node which might change lint levels with attributes.
25702570 /// 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 ( ) ;
25762573 loop {
25772574 if id == bound {
25782575 return bound;
25792576 }
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 ( ) ) {
25812579 return id;
25822580 }
2583- let next = self . hir ( ) . get_parent_node ( id) ;
2581+ let next = hir. get_parent_node ( id) ;
25842582 if next == id {
25852583 bug ! ( "lint traversal reached the root of the crate" ) ;
25862584 }
You can’t perform that action at this time.
0 commit comments