- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Closed
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-edition-2021Area: The 2021 editionArea: The 2021 editionD-editionDiagnostics: An error or lint that should account for edition differences.Diagnostics: An error or lint that should account for edition differences.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.
Description
#![warn(rust_2021_incompatible_closure_captures)]
fn main() {
    let a = ("hey".to_string(), "123".to_string());
    let _ = || {
        dbg!(a.0);
    };
}suggests:
    let _ = || { let _ = &a; 
        dbg!(a.0);
    };It adds let _ = &a; on the same line as the {. There's also an extra space after the ; there.
Instead, it'd be nice if it produced:
    let _ = || {
        let _ = &a;
        dbg!(a.0);
    };Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-edition-2021Area: The 2021 editionArea: The 2021 editionD-editionDiagnostics: An error or lint that should account for edition differences.Diagnostics: An error or lint that should account for edition differences.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.