@@ -35,7 +35,7 @@ use rustc_serialize::json::{self, ToJson};
35
35
use rustc_session:: config:: nightly_options;
36
36
use rustc_session:: config:: { ErrorOutputType , Input , OutputType , PrintRequest } ;
37
37
use rustc_session:: getopts;
38
- use rustc_session:: lint:: { Lint , LintId } ;
38
+ use rustc_session:: lint:: { Level , Lint , LintId } ;
39
39
use rustc_session:: { config, DiagnosticOutput , Session } ;
40
40
use rustc_session:: { early_error, early_warn} ;
41
41
use rustc_span:: source_map:: { FileLoader , FileName } ;
@@ -179,10 +179,6 @@ pub fn run_compiler(
179
179
registry : diagnostics_registry ( ) ,
180
180
} ;
181
181
callbacks. config ( & mut config) ;
182
- // lol no lints at all
183
- config. override_queries = Some ( |_, providers, _| {
184
- providers. lint_mod = |_, _| { } ;
185
- } ) ;
186
182
config
187
183
} ;
188
184
@@ -260,10 +256,12 @@ pub fn run_compiler(
260
256
} ;
261
257
262
258
callbacks. config ( & mut config) ;
263
- // lol no lints at all
264
- config. override_queries = Some ( |_, providers, _| {
265
- providers. lint_mod = |_, _| { } ;
266
- } ) ;
259
+ // Since the warnings from these lints will never be shown, there is no need to run them at all!
260
+ if let Some ( Level :: Allow ) = config. opts . lint_cap {
261
+ config. override_queries = Some ( |_, providers, _| {
262
+ providers. lint_mod = |_, _| { } ;
263
+ } ) ;
264
+ }
267
265
268
266
interface:: run_compiler ( config, |compiler| {
269
267
let sess = compiler. session ( ) ;
0 commit comments