Fix unused_parens false positive when using binary operations

This commit is contained in:
mibac138 2020-05-05 01:55:03 +02:00
parent d626e4dadc
commit 3471bc8306
2 changed files with 29 additions and 4 deletions

View file

@ -0,0 +1,17 @@
// check-pass
// Make sure unused parens lint doesn't emit a false positive.
// See https://github.com/rust-lang/rust/issues/71290 for details.
fn x() -> u8 {
({ 0 }) + 1
}
fn y() -> u8 {
({ 0 } + 1)
}
pub fn foo(a: bool, b: bool) -> u8 {
(if a { 1 } else { 0 } + if b { 1 } else { 0 })
}
fn main() {}