3 #![warn(clippy::match_like_matches_macro)]
4 #![allow(unreachable_patterns, dead_code, clippy::equatable_if_let)]
10 let _y = matches!(x, Some(0));
13 let _w = matches!(x, Some(_));
19 let _zz = !matches!(x, Some(r) if r == 0);
22 let _zzz = matches!(x, Some(5));
46 let _ans = matches!(x, E::A(_) | E::B(_));
50 let _ans = !matches!(x, E::B(_) | E::C);
73 E::A(a) if a < 10 => false,
74 E::B(a) if a < 10 => false,
82 E::B(a) if a < 10 => false,
104 // should print "z" in suggestion (#6503)
106 let _z = matches!(z, Some(3));
110 // this could also print "z" in suggestion..?
112 let _z = matches!(&z, Some(3));
121 fn foo(_x: AnEnum) {}
125 // we can't remove the reference here!
126 let _ = matches!(&z, AnEnum::X);
134 fn fun(_val: Option<S>) {}
135 let val = Some(S(42));
136 // we need the reference here because later val is consumed by fun()
137 let _res = matches!(&val, &Some(ref _a));
144 fn fun(_val: Option<S>) {}
145 let val = Some(S(42));
146 let _res = matches!(&val, &Some(ref _a));