Skip to content
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

clippy does not warn me of shadowing #3979

Closed
bestia-dev opened this issue Apr 17, 2019 · 3 comments
Closed

clippy does not warn me of shadowing #3979

bestia-dev opened this issue Apr 17, 2019 · 3 comments
Labels
C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@bestia-dev
Copy link

clippy 0.0.212 (1fac380 2019-02-20)
I use:
clippy::shadow_reuse,
clippy::shadow_same,
clippy::shadow_unrelated,

I have this code:
let users = Arc::new(Mutex::new(HashMap::new()));
// Turn our "state" into a new Filter...
let users = warp::any().map(move || users.clone());

Clippy does not warn me about this shadowing.
https://github.com/LucianoBestia/mem2_server

@skywhale
Copy link

skywhale commented Oct 2, 2019

Another false negative example. An actual bug introduced during a merge conflict resolution. It would be ideal that clippy had caught it.

let mut consumers = Vec::new();
consumers.push(Consumer::new("this"));

...

// This was inserted by a wrong merge conflict resolution
let mut consumers = Vec::new();

...

consumers.push(Consumer::new("that"));
let _ = Watcher::new(consumers);  // expecting to see both "this" and "that"

@skywhale
Copy link

skywhale commented Oct 2, 2019

@LucianoBestia Let me suggest updating the title to "False negatives from shadow_unrelated rule" for extra clarity. Thanks for making the issue.

@flip1995 flip1995 added the C-bug Category: Clippy is not doing the correct thing label Oct 2, 2019
@flip1995
Copy link
Member

flip1995 commented Oct 2, 2019

Known Problems: This lint, as the other shadowing related lints, currently only catches very simple patterns.

It looks like that these lints need some work.

@flip1995 flip1995 added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

No branches or pull requests

3 participants