let_chains: scrutinee -> head expression.
This commit is contained in:
parent
3b7f0cb7e0
commit
1ff947f596
@ -343,7 +343,7 @@ impl UnusedParens {
|
||||
ast::ExprKind::Let(_, ref expr) => {
|
||||
// FIXME(#60336): Properly handle `let true = (false && true)`
|
||||
// actually needing the parenthesis.
|
||||
self.check_unused_parens_expr(cx, expr, "`let` scrutinee", followed_by_block);
|
||||
self.check_unused_parens_expr(cx, expr, "`let` head expression", followed_by_block);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ fn main() {
|
||||
match (true) { //~ ERROR unnecessary parentheses around `match` head expression
|
||||
_ => {}
|
||||
}
|
||||
if let 1 = (1) {} //~ ERROR unnecessary parentheses around `let` scrutinee
|
||||
while let 1 = (2) {} //~ ERROR unnecessary parentheses around `let` scrutinee
|
||||
if let 1 = (1) {} //~ ERROR unnecessary parentheses around `let` head expression
|
||||
while let 1 = (2) {} //~ ERROR unnecessary parentheses around `let` head expression
|
||||
let v = X { y: false };
|
||||
// struct lits needs parens, so these shouldn't warn.
|
||||
if (v == X { y: true }) {}
|
||||
|
@ -40,13 +40,13 @@ error: unnecessary parentheses around `match` head expression
|
||||
LL | match (true) {
|
||||
| ^^^^^^ help: remove these parentheses
|
||||
|
||||
error: unnecessary parentheses around `let` scrutinee
|
||||
error: unnecessary parentheses around `let` head expression
|
||||
--> $DIR/lint-unnecessary-parens.rs:25:16
|
||||
|
|
||||
LL | if let 1 = (1) {}
|
||||
| ^^^ help: remove these parentheses
|
||||
|
||||
error: unnecessary parentheses around `let` scrutinee
|
||||
error: unnecessary parentheses around `let` head expression
|
||||
--> $DIR/lint-unnecessary-parens.rs:26:19
|
||||
|
|
||||
LL | while let 1 = (2) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user