Skip to content

Commit

Permalink
refactor: Warn not Error on unsupported lint tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Muscraft committed Apr 30, 2024
1 parent a1f8e45 commit 72f265b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2231,8 +2231,13 @@ fn verify_lints(
for (tool, lints) in lints {
let supported = ["cargo", "clippy", "rust", "rustdoc"];
if !supported.contains(&tool.as_str()) {
let supported = supported.join(", ");
anyhow::bail!("unsupported `{tool}` in `[lints]`, must be one of {supported}")
let message = format!(
"unrecognized lint tool `lints.{tool}`, specifying unrecognized tools may break in the future.
supported tools: {}",
supported.join(", "),
);
warnings.push(message);
continue;
}
if tool == "cargo" && !gctx.cli_unstable().cargo_lints {
warn_for_cargo_lint_feature(gctx, warnings);
Expand Down
9 changes: 4 additions & 5 deletions tests/testsuite/lints_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ fn fail_on_invalid_tool() {
.build();

foo.cargo("check")
.with_status(101)
.with_stderr(
"\
[..]
Caused by:
unsupported `super-awesome-linter` in `[lints]`, must be one of cargo, clippy, rust, rustdoc
[WARNING] [CWD]/Cargo.toml: unrecognized lint tool `lints.super-awesome-linter`, specifying unrecognized tools may break in the future.
supported tools: cargo, clippy, rust, rustdoc
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] [..]
",
)
.run();
Expand Down

0 comments on commit 72f265b

Please sign in to comment.