- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.F-let_elseIssues related to let-else statements (RFC 3137)Issues related to let-else statements (RFC 3137)requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
#![feature(let_else)]
fn example_let_else(value: Option<String>) {
    #[allow(unused)]
    let banana = 1;
    #[allow(unused)]
    let Some(chaenomeles) = value else { return };
}here banana will not be linted against as an unused variable, but chaenomeleswill be:
warning: unused variable: `chaenomeles`
 --> src/lib.rs:7:14
  |
7 |     let Some(chaenomeles) = value else { return };
  |              ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_chaenomeles`
  |
  = note: `#[warn(unused_variables)]` on by default
cc #87335
Fishrock123
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.F-let_elseIssues related to let-else statements (RFC 3137)Issues related to let-else statements (RFC 3137)requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.