1
1
use super :: needless_pass_by_value:: requires_exact_signature;
2
2
use clippy_utils:: diagnostics:: span_lint_hir_and_then;
3
3
use clippy_utils:: source:: snippet;
4
- use clippy_utils:: { get_parent_node, is_from_proc_macro, is_self} ;
4
+ use clippy_utils:: { get_parent_node, inherits_cfg , is_from_proc_macro, is_self} ;
5
5
use rustc_data_structures:: fx:: { FxHashSet , FxIndexMap } ;
6
6
use rustc_errors:: Applicability ;
7
7
use rustc_hir:: intravisit:: { walk_qpath, FnKind , Visitor } ;
@@ -12,11 +12,11 @@ use rustc_lint::{LateContext, LateLintPass};
12
12
use rustc_middle:: hir:: map:: associated_body;
13
13
use rustc_middle:: hir:: nested_filter:: OnlyBodies ;
14
14
use rustc_middle:: mir:: FakeReadCause ;
15
- use rustc_middle:: ty:: { self , Ty , TyCtxt , UpvarId , UpvarPath } ;
15
+ use rustc_middle:: ty:: { self , Ty , UpvarId , UpvarPath } ;
16
16
use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
17
- use rustc_span:: def_id:: { LocalDefId , CRATE_DEF_ID } ;
17
+ use rustc_span:: def_id:: LocalDefId ;
18
18
use rustc_span:: symbol:: kw;
19
- use rustc_span:: { sym , Span } ;
19
+ use rustc_span:: Span ;
20
20
use rustc_target:: spec:: abi:: Abi ;
21
21
22
22
declare_clippy_lint ! {
@@ -93,16 +93,6 @@ fn should_skip<'tcx>(
93
93
is_from_proc_macro ( cx, & input)
94
94
}
95
95
96
- fn inherits_cfg ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> bool {
97
- if def_id == CRATE_DEF_ID {
98
- false
99
- } else if tcx. has_attr ( def_id, sym:: cfg) {
100
- true
101
- } else {
102
- inherits_cfg ( tcx, tcx. parent_module_from_def_id ( def_id) )
103
- }
104
- }
105
-
106
96
impl < ' tcx > LateLintPass < ' tcx > for NeedlessPassByRefMut < ' tcx > {
107
97
fn check_fn (
108
98
& mut self ,
0 commit comments