File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ fn main() {
5050 struct S;
5151 let r: Result<i32, S> = Ok(3);
5252 let _ = r.is_ok_and(|x| x == 7);
53+
54+ #[derive(PartialEq)]
55+ struct S2;
56+ let r: Result<i32, S2> = Ok(4);
57+ let _ = (r == Ok(8));
5358}
5459
5560#[clippy::msrv = "1.69.0"]
Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ fn main() {
5353 struct S ;
5454 let r: Result < i32 , S > = Ok ( 3 ) ;
5555 let _ = r. map_or ( false , |x| x == 7 ) ;
56+
57+ #[ derive( PartialEq ) ]
58+ struct S2 ;
59+ let r: Result < i32 , S2 > = Ok ( 4 ) ;
60+ let _ = r. map_or ( false , |x| x == 8 ) ;
5661}
5762
5863#[ clippy:: msrv = "1.69.0" ]
Original file line number Diff line number Diff line change @@ -89,5 +89,11 @@ error: this `map_or` is redundant
8989LL | let _ = r.map_or(false, |x| x == 7);
9090 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_ok_and instead: `r.is_ok_and(|x| x == 7)`
9191
92- error: aborting due to 12 previous errors
92+ error: this `map_or` is redundant
93+ --> tests/ui/unnecessary_map_or.rs:60:13
94+ |
95+ LL | let _ = r.map_or(false, |x| x == 8);
96+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(r == Ok(8))`
97+
98+ error: aborting due to 13 previous errors
9399
You can’t perform that action at this time.
0 commit comments