-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
A-lintArea: New lintsArea: New lintsL-correctnessLint: Belongs in the correctness lint groupLint: Belongs in the correctness lint groupT-MIRType: This lint will require working with the MIRType: This lint will require working with the MIR
Description
In both the rust source and the rustfmt source I encountered code of the sort
let first = false;
for x in y {
if first {
first = false;
// do some logic
}
// do some logic
}
If a variable never gets a mutable reference taken to and all assignments assign the same value, we should have a correctness lint tell the user they are doing something that makes no sense in any program.
This is probably easiest implemented as an MIR lint
matthiaskrgr, oxalica, maurobalbi and Centri3
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-correctnessLint: Belongs in the correctness lint groupLint: Belongs in the correctness lint groupT-MIRType: This lint will require working with the MIRType: This lint will require working with the MIR