Closed
Description
I tried this very normal code: link
#![allow(unreachable_code)]
fn main() {
if (() = return) {}
if ((..{}) == ..{}) {}
}
The current output is the following, but removing any of the parens is an error:
Compiling playground v0.0.1 (/playground)
warning: unnecessary parentheses around `if` condition
--> src/main.rs:4:8
|
4 | if (() = return) {}
| ^ ^
|
= note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
|
4 - if (() = return) {}
4 + if () = return {}
|
warning: unnecessary parentheses around `if` condition
--> src/main.rs:5:8
|
5 | if ((..{}) == ..{}) {}
| ^ ^
|
help: remove these parentheses
|
5 - if ((..{}) == ..{}) {}
5 + if (..{}) == ..{} {}
|
warning: `playground` (bin "playground") generated 2 warnings
Finished dev [unoptimized + debuginfo] target(s) in 0.99s
Running `target/debug/playground`
This also gets cargo fix
ed incorrectly.
This need to change to look at the rhs of binops:
rust/compiler/rustc_lint/src/unused.rs
Lines 591 to 601 in 661b33f
@rustbot label T-compiler A-lint A-diagnostics