Skip to content

Unused variables inside if-let guards don't get detected #119383

Closed
@fmease

Description

@fmease

I expected the following code to fail to compile due to the unused variable unused but it actually compiled successfully:

#![feature(if_let_guard)]
#![deny(unused_variables)]

fn main() {
    match () {
        () if let Some(unused) = Some(()) => {}
        _ => {}
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.F-if_let_guard`#![feature(if_let_guard)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions