mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
30 lines
589 B
Rust
30 lines
589 B
Rust
//@ check-pass
|
|
//@ compile-flags: --edition 2018
|
|
//@ run-rustfix
|
|
|
|
#![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(()) => (),
|
|
}
|
|
}
|