Skip to content

Commit 72f265b

Browse files
committed
refactor: Warn not Error on unsupported lint tool
1 parent a1f8e45 commit 72f265b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,8 +2231,13 @@ fn verify_lints(
22312231
for (tool, lints) in lints {
22322232
let supported = ["cargo", "clippy", "rust", "rustdoc"];
22332233
if !supported.contains(&tool.as_str()) {
2234-
let supported = supported.join(", ");
2235-
anyhow::bail!("unsupported `{tool}` in `[lints]`, must be one of {supported}")
2234+
let message = format!(
2235+
"unrecognized lint tool `lints.{tool}`, specifying unrecognized tools may break in the future.
2236+
supported tools: {}",
2237+
supported.join(", "),
2238+
);
2239+
warnings.push(message);
2240+
continue;
22362241
}
22372242
if tool == "cargo" && !gctx.cli_unstable().cargo_lints {
22382243
warn_for_cargo_lint_feature(gctx, warnings);

tests/testsuite/lints_table.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,12 @@ fn fail_on_invalid_tool() {
105105
.build();
106106

107107
foo.cargo("check")
108-
.with_status(101)
109108
.with_stderr(
110109
"\
111-
[..]
112-
113-
Caused by:
114-
unsupported `super-awesome-linter` in `[lints]`, must be one of cargo, clippy, rust, rustdoc
110+
[WARNING] [CWD]/Cargo.toml: unrecognized lint tool `lints.super-awesome-linter`, specifying unrecognized tools may break in the future.
111+
supported tools: cargo, clippy, rust, rustdoc
112+
[CHECKING] foo v0.0.1 ([CWD])
113+
[FINISHED] [..]
115114
",
116115
)
117116
.run();

0 commit comments

Comments
 (0)