File tree 3 files changed +11
-1
lines changed 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ fn main() {
16
16
let _: Result<i8, f32> = Err(2.3).map(|x: i8| {
17
17
return x + 3;
18
18
});
19
+ let _: Result<u32, u32> = Ok(1);
20
+ let _: Result<u32, u32> = Ok(1).map_err(|a: u32| a * 42);
19
21
}
20
22
21
23
fn not_identity(x: &u16) -> u16 {
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ fn main() {
18
18
let _: Result < i8 , f32 > = Err ( 2.3 ) . map ( |x : i8 | {
19
19
return x + 3 ;
20
20
} ) ;
21
+ let _: Result < u32 , u32 > = Ok ( 1 ) . map_err ( |a| a) ;
22
+ let _: Result < u32 , u32 > = Ok ( 1 ) . map_err ( |a : u32 | a * 42 ) ;
21
23
}
22
24
23
25
fn not_identity ( x : & u16 ) -> u16 {
Original file line number Diff line number Diff line change @@ -33,5 +33,11 @@ LL | | return x;
33
33
LL | | });
34
34
| |______^ help: remove the call to `map`
35
35
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
37
43
You can’t perform that action at this time.
0 commit comments