1
1
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
2
- --> tests/ui/map_unwrap_or_fixable.rs:16 :13
2
+ --> tests/ui/map_unwrap_or_fixable.rs:17 :13
3
3
|
4
4
LL | let _ = opt.map(|x| x + 1)
5
5
| _____________^
@@ -11,7 +11,7 @@ LL | | .unwrap_or_else(|| 0);
11
11
= help: to override `-D warnings` add `#[allow(clippy::map_unwrap_or)]`
12
12
13
13
error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
14
- --> tests/ui/map_unwrap_or_fixable.rs:47 :13
14
+ --> tests/ui/map_unwrap_or_fixable.rs:48 :13
15
15
|
16
16
LL | let _ = res.map(|x| x + 1)
17
17
| _____________^
@@ -20,7 +20,7 @@ LL | | .unwrap_or_else(|_e| 0);
20
20
| |_______________________________^ help: try: `res.map_or_else(|_e| 0, |x| x + 1)`
21
21
22
22
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value
23
- --> tests/ui/map_unwrap_or_fixable.rs:64 :20
23
+ --> tests/ui/map_unwrap_or_fixable.rs:65 :20
24
24
|
25
25
LL | println!("{}", o.map(|y| y + 1).unwrap_or(3));
26
26
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -32,13 +32,13 @@ LL + println!("{}", o.map_or(3, |y| y + 1));
32
32
|
33
33
34
34
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
35
- --> tests/ui/map_unwrap_or_fixable.rs:66 :20
35
+ --> tests/ui/map_unwrap_or_fixable.rs:67 :20
36
36
|
37
37
LL | println!("{}", o.map(|y| y + 1).unwrap_or_else(|| 3));
38
38
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `o.map_or_else(|| 3, |y| y + 1)`
39
39
40
40
error: called `map(<f>).unwrap_or(<a>)` on an `Result` value
41
- --> tests/ui/map_unwrap_or_fixable.rs:68 :20
41
+ --> tests/ui/map_unwrap_or_fixable.rs:69 :20
42
42
|
43
43
LL | println!("{}", r.map(|y| y + 1).unwrap_or(3));
44
44
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,13 +50,13 @@ LL + println!("{}", r.map_or(3, |y| y + 1));
50
50
|
51
51
52
52
error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
53
- --> tests/ui/map_unwrap_or_fixable.rs:70 :20
53
+ --> tests/ui/map_unwrap_or_fixable.rs:71 :20
54
54
|
55
55
LL | println!("{}", r.map(|y| y + 1).unwrap_or_else(|()| 3));
56
56
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `r.map_or_else(|()| 3, |y| y + 1)`
57
57
58
58
error: called `map(<f>).unwrap_or(false)` on an `Result` value
59
- --> tests/ui/map_unwrap_or_fixable.rs:73 :20
59
+ --> tests/ui/map_unwrap_or_fixable.rs:74 :20
60
60
|
61
61
LL | println!("{}", r.map(|y| y == 1).unwrap_or(false));
62
62
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -67,5 +67,41 @@ LL - println!("{}", r.map(|y| y == 1).unwrap_or(false));
67
67
LL + println!("{}", r.is_ok_and(|y| y == 1));
68
68
|
69
69
70
- error: aborting due to 7 previous errors
70
+ error: called `map(<f>).unwrap_or(<a>)` on an `Option` value
71
+ --> tests/ui/map_unwrap_or_fixable.rs:80:20
72
+ |
73
+ LL | println!("{}", x.map(|y| y + 1).unwrap_or(3));
74
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75
+ |
76
+ help: use `map_or(<a>, <f>)` instead
77
+ |
78
+ LL - println!("{}", x.map(|y| y + 1).unwrap_or(3));
79
+ LL + println!("{}", x.map_or(3, |y| y + 1));
80
+ |
81
+
82
+ error: called `map(<f>).unwrap_or(<a>)` on an `Result` value
83
+ --> tests/ui/map_unwrap_or_fixable.rs:84:20
84
+ |
85
+ LL | println!("{}", x.map(|y| y + 1).unwrap_or(3));
86
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87
+ |
88
+ help: use `map_or(<a>, <f>)` instead
89
+ |
90
+ LL - println!("{}", x.map(|y| y + 1).unwrap_or(3));
91
+ LL + println!("{}", x.map_or(3, |y| y + 1));
92
+ |
93
+
94
+ error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
95
+ --> tests/ui/map_unwrap_or_fixable.rs:88:20
96
+ |
97
+ LL | println!("{}", x.map(|y| y + 1).unwrap_or_else(|| 3));
98
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map_or_else(|| 3, |y| y + 1)`
99
+
100
+ error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
101
+ --> tests/ui/map_unwrap_or_fixable.rs:92:20
102
+ |
103
+ LL | println!("{}", x.map(|y| y + 1).unwrap_or_else(|_| 3));
104
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map_or_else(|_| 3, |y| y + 1)`
105
+
106
+ error: aborting due to 11 previous errors
71
107
0 commit comments