summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/ignored_unit_patterns.fixed
blob: 6c6f21fee16b0684883417f9712c96b0d3daf30a (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
#![warn(clippy::ignored_unit_patterns)]
#![allow(clippy::let_unit_value, 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
}

#[allow(unused)]
pub fn moo(_: ()) {
    let () = foo().unwrap();
    //~^ ERROR: matching over `()` is more explicit
    let _: () = foo().unwrap();
    let _: () = ();
}