Skip to content

shadow_unrelated false positive with question mark #6563

@camsteffen

Description

@camsteffen

Lint name: shadow_unrelated

I tried this code:

#[warn(clippy::shadow_unrelated)]
fn foo() -> Option<i32> {
    let a = 1_i32;
    let a = Some(1).map(|_| a)?;
    Some(a)
}

I expected to see this happen: no lint

Instead, this happened: shadow_unrelated lint

I needed a closure and a question mark to reproduce this. 🤷

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions