rust/tests/ui/ignored_unit_patterns.fixed
2023-09-04 17:05:03 +02:00

18 lines
514 B
Rust

#![warn(clippy::ignored_unit_patterns)]
#![allow(clippy::redundant_pattern_matching, clippy::single_match)]
fn foo() -> Result<(), ()> {
unimplemented!()
}
fn main() {
match foo() {
Ok(()) => {}, //~ ERROR: matching over `()` is more explicit
Err(()) => {}, //~ ERROR: matching over `()` is more explicit
}
if let Ok(()) = foo() {}
//~^ ERROR: matching over `()` is more explicit
let _ = foo().map_err(|()| todo!());
//~^ ERROR: matching over `()` is more explicit
}