Skip to content

Commit 11f7dcc

Browse files
committed
Clean up lint pass
1 parent 2712651 commit 11f7dcc

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/librustc_driver/lib.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use rustc_serialize::json::{self, ToJson};
3535
use rustc_session::config::nightly_options;
3636
use rustc_session::config::{ErrorOutputType, Input, OutputType, PrintRequest};
3737
use rustc_session::getopts;
38-
use rustc_session::lint::{Lint, LintId};
38+
use rustc_session::lint::{Level, Lint, LintId};
3939
use rustc_session::{config, DiagnosticOutput, Session};
4040
use rustc_session::{early_error, early_warn};
4141
use rustc_span::source_map::{FileLoader, FileName};
@@ -179,10 +179,6 @@ pub fn run_compiler(
179179
registry: diagnostics_registry(),
180180
};
181181
callbacks.config(&mut config);
182-
// lol no lints at all
183-
config.override_queries = Some(|_, providers, _| {
184-
providers.lint_mod = |_, _| {};
185-
});
186182
config
187183
};
188184

@@ -260,10 +256,12 @@ pub fn run_compiler(
260256
};
261257

262258
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+
}
267265

268266
interface::run_compiler(config, |compiler| {
269267
let sess = compiler.session();

0 commit comments

Comments
 (0)