2020-04-14 10:45:00 -05:00
|
|
|
// check-pass
|
|
|
|
// compile-flags: --edition 2018
|
2020-07-02 00:32:12 -05:00
|
|
|
// run-rustfix
|
2020-04-14 10:45:00 -05:00
|
|
|
|
|
|
|
#![feature(try_blocks)]
|
|
|
|
#![warn(unused_parens, unused_braces)]
|
|
|
|
|
|
|
|
fn consume<T>(_: Result<T, T>) -> T { todo!() }
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
consume((try {}));
|
|
|
|
//~^ WARN unnecessary parentheses
|
|
|
|
|
|
|
|
consume({ try {} });
|
|
|
|
//~^ WARN unnecessary braces
|
|
|
|
|
|
|
|
match (try {}) {
|
|
|
|
//~^ WARN unnecessary parentheses
|
|
|
|
Ok(()) | Err(()) => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Err(()) = (try {}) {}
|
|
|
|
//~^ WARN unnecessary parentheses
|
|
|
|
|
|
|
|
match (try {}) {
|
|
|
|
//~^ WARN unnecessary parentheses
|
|
|
|
Ok(()) | Err(()) => (),
|
|
|
|
}
|
|
|
|
}
|