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

Incorrect message in shadow_unrelated #3619

Open
Riateche opened this issue Jan 3, 2019 · 0 comments
Open

Incorrect message in shadow_unrelated #3619

Riateche opened this issue Jan 3, 2019 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@Riateche
Copy link

Riateche commented Jan 3, 2019

cargo clippy -V
clippy 0.0.212 (2e26fdc 2018-11-22)

Code:

#![deny(clippy::shadow_unrelated)]

enum A {
    B { cast: i32, },
    C
}

fn fun(cast: u32) {
    let a = A::C;
    if let A::B { cast } = a {
        println!("{}", cast);
    }
}

fn main() {
    println!("Hello, world!");
}

Error message:

error: `cast` is shadowed by `a`

It's unclear how cast can be shadowed by a, given that they have different names. Something like "cast shadowed by cast" or "cast variable shadowed by an if let binding" might be more understandable.

@phansch phansch added the C-bug Category: Clippy is not doing the correct thing label Jan 3, 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
Projects
None yet
Development

No branches or pull requests

2 participants