Skip to content

Incorrect message in shadow_unrelated #3619

Closed
@Riateche

Description

@Riateche
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions