Skip to content

Commit 9bfa95b

Browse files
authored
Allow --print=crate-root-lint-levels (#15567)
#13468 delegated all `--print` requests to `rustc`; this PR adds an exception to `crate-root-lint-levels` (rust-lang/rust#139180), i.e.: ``` $ rustc -Zunstable-options --print=crate-root-lint-levels /dev/null | wc -l 230 $ clippy-driver -Zunstable-options --print=crate-root-lint-levels /dev/null | wc -l 230 $ cargo run --bin clippy-driver -- -Zunstable-options --print=crate-root-lint-levels /dev/null | wc -l 1020 ``` So as to have a way to print all Clippy lint levels in a machine-readable format. ---- changelog: none
2 parents c394c00 + a165008 commit 9bfa95b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/driver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ pub fn main() {
330330

331331
// Do not run Clippy for Cargo's info queries so that invalid CLIPPY_ARGS are not cached
332332
// https://github.com/rust-lang/cargo/issues/14385
333-
let info_query = has_arg(&orig_args, "-vV") || has_arg(&orig_args, "--print");
333+
let info_query = has_arg(&orig_args, "-vV")
334+
|| arg_value(&orig_args, "--print", |val| val != "crate-root-lint-levels").is_some();
334335

335336
let clippy_enabled = !cap_lints_allow && relevant_package && !info_query;
336337
if clippy_enabled {

0 commit comments

Comments
 (0)