blob: ce087fb351d63e4823ab88056bc47447ccb08d9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// 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(()) => (),
}
}
|