Skip to content

cargo-clippy should not fail early on lints that default to deny #87334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sxlijin opened this issue Jul 21, 2021 · 3 comments
Closed

cargo-clippy should not fail early on lints that default to deny #87334

sxlijin opened this issue Jul 21, 2021 · 3 comments
Labels
A-clippy Area: Clippy A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sxlijin
Copy link

sxlijin commented Jul 21, 2021

Latest stable cargo check and cargo build (1.53.0) both succeed on BurntSushi/ripgrep@0ff5dd2, but cargo clippy fails on a lint that defaults to deny.

My expectation with a linter is that, on a well-formed AST (i.e. one that successfully can be compiled), it should show me all the lint errors in the code being linted so that I can triage/address them at my/our own discretion. Currently clippy bails out fast.

Although it is possible to downgrade deny lints to warn, I don't think this is very desirable, since it causes the user to lose information about the severity of the lint issue.

It was pointed out to me in the Zulip (thanks @jyn514 !) that there are a few levels of issues here:

  • this can't be done in just clippy and needs rustc work for this to happen when compiling a single crate
  • for inter-crate compilation, rustc would need to start distinguishing lint-only errors in output
@sxlijin sxlijin added the C-bug Category: This is a bug. label Jul 21, 2021
@jyn514 jyn514 added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR. A-clippy Area: Clippy T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed C-bug Category: This is a bug. labels Jul 21, 2021
@jyn514
Copy link
Member

jyn514 commented Jul 21, 2021

for inter-crate compilation, rustc would need to start distinguishing lint-only errors in output

To clarify: it would be fine for this to be rustc-only at first, but it doesn't solve the full issue if there's a path dependency, because rustc would print all lints for the first crate, error out, and then cargo would see the error and stop before compiling the next crate in the workspace.

@SNCPlay42
Copy link
Contributor

See also #82761

@jyn514
Copy link
Member

jyn514 commented Jul 21, 2021

Closing in favor of #82761.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clippy Area: Clippy A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants