-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesL-styleLint: Belongs in the style lint groupLint: Belongs in the style lint group
Description
I have some code that looks like this.
let ok = true;
if check1() {
// Log some info.
ok = false;
}
if check2() {
// Log some info.
ok = false;
}
if check3() {
// Log some info.
ok = false;
}
However clippy gives me a useless_let_if_seq
saying that I should merge the first if into the let
. I don't think this is a helpful suggestion because 1) It makes the first check look special and 2) it distracts a bit from the true
until marked false
.
After thinking about this a bit I think that if the variable defined from the let
is set from multiple locations in the code then this warning should probably be suppressed.
LPGhatguy and bbx0
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesL-styleLint: Belongs in the style lint groupLint: Belongs in the style lint group