- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Open
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.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Description
This is related to #90465.
The problem is code as follows
    let x = ...;
    let c = move || {
        let _ = x;
    };or also
fn foo() {
    let x: u32;
    let _ = x; 
}The let _ = x statement in both cases has no effect at all:
- In the first case with the 2021 edition it does not move the 
xinto the closure. With the 2018 edition it is moved into the closure however. - In the second case the variable 
xis not even initialized. 
As the statement generally has no effect, it would be good to warn if it used like in the above cases. The author of the code probably intended something that the code is not actually doing.
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.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team