File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ fn main() {
1616 let _: Result<i8, f32> = Err(2.3).map(|x: i8| {
1717 return x + 3;
1818 });
19+ let _: Result<u32, u32> = Ok(1);
20+ let _: Result<u32, u32> = Ok(1).map_err(|a: u32| a * 42);
1921}
2022
2123fn not_identity(x: &u16) -> u16 {
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ fn main() {
1818 let _: Result < i8 , f32 > = Err ( 2.3 ) . map ( |x : i8 | {
1919 return x + 3 ;
2020 } ) ;
21+ let _: Result < u32 , u32 > = Ok ( 1 ) . map_err ( |a| a) ;
22+ let _: Result < u32 , u32 > = Ok ( 1 ) . map_err ( |a : u32 | a * 42 ) ;
2123}
2224
2325fn not_identity ( x : & u16 ) -> u16 {
Original file line number Diff line number Diff line change @@ -33,5 +33,11 @@ LL | | return x;
3333LL | | });
3434 | |______^ help: remove the call to `map`
3535
36- error: aborting due to 5 previous errors
36+ error: unnecessary map of the identity function
37+ --> $DIR/map_identity.rs:21:36
38+ |
39+ LL | let _: Result<u32, u32> = Ok(1).map_err(|a| a);
40+ | ^^^^^^^^^^^^^^^ help: remove the call to `map_err`
41+
42+ error: aborting due to 6 previous errors
3743
You can’t perform that action at this time.
0 commit comments