]> git.lizzy.rs Git - rust.git/blob - tests/ui/match_expr_like_matches_macro.fixed
Auto merge of #5980 - matsujika:create-dir, r=flip1995
[rust.git] / tests / ui / match_expr_like_matches_macro.fixed
1 // run-rustfix
2
3 #![warn(clippy::match_like_matches_macro)]
4 #![allow(unreachable_patterns)]
5
6 fn main() {
7     let x = Some(5);
8
9     // Lint
10     let _y = matches!(x, Some(0));
11
12     // Lint
13     let _w = matches!(x, Some(_));
14
15     // Turn into is_none
16     let _z = x.is_none();
17
18     // Lint
19     let _zz = !matches!(x, Some(r) if r == 0);
20
21     // Lint
22     let _zzz = matches!(x, Some(5));
23
24     // No lint
25     let _a = match x {
26         Some(_) => false,
27         _ => false,
28     };
29
30     // No lint
31     let _ab = match x {
32         Some(0) => false,
33         _ => true,
34         None => false,
35     };
36 }