rust/tests/ui/try-block/try-block-unused-delims.fixed

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
577 B
Rust
Raw Normal View History

2020-07-02 05:32:12 +00:00
//@ 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
2020-08-10 10:04:51 +00:00
consume(try {});
2020-07-02 05:32:12 +00:00
//~^ WARN unnecessary braces
match try {} {
//~^ WARN unnecessary parentheses
Ok(()) | Err(()) => (),
}
if let Err(()) = try {} {}
//~^ WARN unnecessary parentheses
match try {} {
//~^ WARN unnecessary parentheses
Ok(()) | Err(()) => (),
}
}