Skip to content

Commit e4e3278

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

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,8 +2231,15 @@ 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}`
2236+
2237+
specifying an unrecognized lint tool could lead to future breakage, as `cargo`
2238+
reserves all of the `lints` namespace for itself and provides no compatibility
2239+
guarantees when encountering unrecognized tools"
2240+
);
2241+
warnings.push(message);
2242+
continue;
22362243
}
22372244
if tool == "cargo" && !gctx.cli_unstable().cargo_lints {
22382245
warn_for_cargo_lint_feature(gctx, warnings);

tests/testsuite/lints_table.rs

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

107107
foo.cargo("check")
108-
.with_status(101)
109108
.with_stderr(
110109
"\
111-
[..]
110+
[WARNING] [CWD]/Cargo.toml: unrecognized lint tool `lints.super-awesome-linter`
112111
113-
Caused by:
114-
unsupported `super-awesome-linter` in `[lints]`, must be one of cargo, clippy, rust, rustdoc
112+
specifying an unrecognized lint tool could lead to future breakage, as `cargo`
113+
reserves all of the `lints` namespace for itself and provides no compatibility
114+
guarantees when encountering unrecognized tools
115+
[CHECKING] foo v0.0.1 ([CWD])
116+
[FINISHED] [..]
115117
",
116118
)
117119
.run();

0 commit comments

Comments
 (0)