File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -95,9 +95,17 @@ macro_rules! declare_combined_late_lint_pass {
95
95
}
96
96
97
97
impl <' tcx> $name<' tcx> {
98
- $v fn new( _tcx: TyCtxt <' tcx>) -> Self {
98
+ $v fn new( tcx: TyCtxt <' tcx>) -> Self {
99
+ let lints_that_dont_need_to_run = tcx. lints_that_dont_need_to_run( ( ) ) ;
99
100
let mut passes = vec![ ] ;
100
101
$( passes. push( Box :: new( $constructor) as Box <dyn LateLintPass <' tcx>>) ; ) *
102
+ passes. retain( |pass| {
103
+ let lints = ( * * pass) . get_lints( ) ;
104
+ // Lintless passes are always in
105
+ lints. is_empty( ) ||
106
+ // If the pass doesn't have a single needed lint, omit it
107
+ !lints. iter( ) . all( |lint| lints_that_dont_need_to_run. contains( & LintId :: of( lint) ) )
108
+ } ) ;
101
109
$name { inner: RuntimeCombinedLateLintPass { passes } }
102
110
}
103
111
You can’t perform that action at this time.
0 commit comments