let_chains: scrutinee -> head expression.

This commit is contained in:
Mazdak Farrokhzad 2019-05-18 01:22:43 +02:00
parent 3b7f0cb7e0
commit 1ff947f596
3 changed files with 5 additions and 5 deletions

View File

@ -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);
}
_ => {}
}

View File

@ -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 }) {}

View File

@ -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) {}