Skip to content

cargo returns outdated warnings #7862

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
matthiaskrgr opened this issue Feb 4, 2020 · 8 comments
Closed

cargo returns outdated warnings #7862

matthiaskrgr opened this issue Feb 4, 2020 · 8 comments
Labels
A-cache-messages Area: caching of compiler messages C-bug Category: bug Command-clippy

Comments

@matthiaskrgr
Copy link
Member

code:

fn main() {
    let a = 0;
}

compiles:

$cargo clippy
    Checking warn v0.1.0 (/tmp/warn)
warning: unused variable: `a`
 --> src/main.rs:2:9
  |
2 |     let a = 0;
  |         ^ help: consider prefixing with an underscore: `_a`
  |
  = note: `#[warn(unused_variables)]` on by default

Suppressing the warning via cli parameters does no longer work until the project is rebuilt from scratch:

$cargo clippy -- -Aunused_variables
warning: unused variable: `a`
 --> src/main.rs:2:9
  |
2 |     let a = 0;
  |         ^ help: consider prefixing with an underscore: `_a`
  |
  = note: `#[warn(unused_variables)]` on by default

    Finished dev [unoptimized + debuginfo] target(s) in 0.00s

cargo 1.42.0-nightly (9d32b7b01 2020-01-26)

@matthiaskrgr matthiaskrgr added the C-bug Category: bug label Feb 4, 2020
@aleksator
Copy link
Contributor

Isn't it an issue with clippy so should be filed against that?
https://github.com/rust-lang/rust-clippy

@ehuss
Copy link
Contributor

ehuss commented Feb 18, 2020

This is a known issue that will be fixed by #7533.

You can use cargo clippy-preview on nightly to avoid this for now.

@aleksator
Copy link
Contributor

Triage: the PR #7533 has landed, but the issue persist.

@ehuss
Copy link
Contributor

ehuss commented Mar 23, 2020

To be clear, there's a second part where clippy will need to be updated to use the new functionality. There is a rough outline here.

@aleksator
Copy link
Contributor

Seems like there is some related ongoing work over here.

@ehuss
Copy link
Contributor

ehuss commented Apr 21, 2020

Oh, I think I misunderstood the original request here, which is specifically around changing the args passed to clippy (like -Aunused_variables). Indeed these are not tracked in the fingerprint or hash (cargo-clippy hides them via __CLIPPY_HACKERY__).

I don't offhand have ideas on how to improve that. Probably clippy could pass those via something like RUSTFLAGS and Cargo could be better about including rustflags in the hash or fingerprint.

@Emilgardis
Copy link
Contributor

This is quite annoying for me because I use clippy -- --deny warnings in a commit hook.

This also makes it difficult to use with cargo watch (used by for example Rust Analyzer) and wanting to pass --message-format=short or whatever you want in your own build.

@ebroto
Copy link
Member

ebroto commented Dec 13, 2020

I think this can be closed as it was fixed in clippy#6441

@ehuss ehuss closed this as completed Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cache-messages Area: caching of compiler messages C-bug Category: bug Command-clippy
Projects
None yet
Development

No branches or pull requests

5 participants