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 {
9595 }
9696
9797 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( ( ) ) ;
99100 let mut passes = vec![ ] ;
100101 $( 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+ } ) ;
101109 $name { inner: RuntimeCombinedLateLintPass { passes } }
102110 }
103111
You can’t perform that action at this time.
0 commit comments