1
- error: this `map_or` is redundant
1
+ error: this `map_or` can be simplified
2
2
--> tests/ui/unnecessary_map_or.rs:12:13
3
3
|
4
4
LL | let _ = Some(5).map_or(false, |n| n == 5);
@@ -7,13 +7,13 @@ LL | let _ = Some(5).map_or(false, |n| n == 5);
7
7
= note: `-D clippy::unnecessary-map-or` implied by `-D warnings`
8
8
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]`
9
9
10
- error: this `map_or` is redundant
10
+ error: this `map_or` can be simplified
11
11
--> tests/ui/unnecessary_map_or.rs:13:13
12
12
|
13
13
LL | let _ = Some(5).map_or(true, |n| n != 5);
14
14
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(Some(5) != Some(5))`
15
15
16
- error: this `map_or` is redundant
16
+ error: this `map_or` can be simplified
17
17
--> tests/ui/unnecessary_map_or.rs:14:13
18
18
|
19
19
LL | let _ = Some(5).map_or(false, |n| {
@@ -23,7 +23,7 @@ LL | | n == 5
23
23
LL | | });
24
24
| |______^ help: use a standard comparison instead: `(Some(5) == Some(5))`
25
25
26
- error: this `map_or` is redundant
26
+ error: this `map_or` can be simplified
27
27
--> tests/ui/unnecessary_map_or.rs:18:13
28
28
|
29
29
LL | let _ = Some(5).map_or(false, |n| {
@@ -41,85 +41,85 @@ LL + 6 >= 5
41
41
LL ~ });
42
42
|
43
43
44
- error: this `map_or` is redundant
44
+ error: this `map_or` can be simplified
45
45
--> tests/ui/unnecessary_map_or.rs:22:13
46
46
|
47
47
LL | let _ = Some(vec![5]).map_or(false, |n| n == [5]);
48
48
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `Some(vec![5]).is_some_and(|n| n == [5])`
49
49
50
- error: this `map_or` is redundant
50
+ error: this `map_or` can be simplified
51
51
--> tests/ui/unnecessary_map_or.rs:23:13
52
52
|
53
53
LL | let _ = Some(vec![1]).map_or(false, |n| vec![2] == n);
54
54
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `Some(vec![1]).is_some_and(|n| vec![2] == n)`
55
55
56
- error: this `map_or` is redundant
56
+ error: this `map_or` can be simplified
57
57
--> tests/ui/unnecessary_map_or.rs:24:13
58
58
|
59
59
LL | let _ = Some(5).map_or(false, |n| n == n);
60
60
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `Some(5).is_some_and(|n| n == n)`
61
61
62
- error: this `map_or` is redundant
62
+ error: this `map_or` can be simplified
63
63
--> tests/ui/unnecessary_map_or.rs:25:13
64
64
|
65
65
LL | let _ = Some(5).map_or(false, |n| n == if 2 > 1 { n } else { 0 });
66
66
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `Some(5).is_some_and(|n| n == if 2 > 1 { n } else { 0 })`
67
67
68
- error: this `map_or` is redundant
68
+ error: this `map_or` can be simplified
69
69
--> tests/ui/unnecessary_map_or.rs:26:13
70
70
|
71
71
LL | let _ = Ok::<Vec<i32>, i32>(vec![5]).map_or(false, |n| n == [5]);
72
72
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_ok_and instead: `Ok::<Vec<i32>, i32>(vec![5]).is_ok_and(|n| n == [5])`
73
73
74
- error: this `map_or` is redundant
74
+ error: this `map_or` can be simplified
75
75
--> tests/ui/unnecessary_map_or.rs:27:13
76
76
|
77
77
LL | let _ = Ok::<i32, i32>(5).map_or(false, |n| n == 5);
78
78
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(Ok::<i32, i32>(5) == Ok(5))`
79
79
80
- error: this `map_or` is redundant
80
+ error: this `map_or` can be simplified
81
81
--> tests/ui/unnecessary_map_or.rs:28:13
82
82
|
83
83
LL | let _ = Some(5).map_or(false, |n| n == 5).then(|| 1);
84
84
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(Some(5) == Some(5))`
85
85
86
- error: this `map_or` is redundant
86
+ error: this `map_or` can be simplified
87
87
--> tests/ui/unnecessary_map_or.rs:29:13
88
88
|
89
89
LL | let _ = Some(5).map_or(true, |n| n == 5);
90
90
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_none_or instead: `Some(5).is_none_or(|n| n == 5)`
91
91
92
- error: this `map_or` is redundant
92
+ error: this `map_or` can be simplified
93
93
--> tests/ui/unnecessary_map_or.rs:30:13
94
94
|
95
95
LL | let _ = Some(5).map_or(true, |n| 5 == n);
96
96
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_none_or instead: `Some(5).is_none_or(|n| 5 == n)`
97
97
98
- error: this `map_or` is redundant
98
+ error: this `map_or` can be simplified
99
99
--> tests/ui/unnecessary_map_or.rs:54:13
100
100
|
101
101
LL | let _ = r.map_or(false, |x| x == 7);
102
102
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_ok_and instead: `r.is_ok_and(|x| x == 7)`
103
103
104
- error: this `map_or` is redundant
104
+ error: this `map_or` can be simplified
105
105
--> tests/ui/unnecessary_map_or.rs:59:13
106
106
|
107
107
LL | let _ = r.map_or(false, func);
108
108
| ^^^^^^^^^^^^^^^^^^^^^ help: use is_ok_and instead: `r.is_ok_and(func)`
109
109
110
- error: this `map_or` is redundant
110
+ error: this `map_or` can be simplified
111
111
--> tests/ui/unnecessary_map_or.rs:60:13
112
112
|
113
113
LL | let _ = Some(5).map_or(false, func);
114
114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `Some(5).is_some_and(func)`
115
115
116
- error: this `map_or` is redundant
116
+ error: this `map_or` can be simplified
117
117
--> tests/ui/unnecessary_map_or.rs:61:13
118
118
|
119
119
LL | let _ = Some(5).map_or(true, func);
120
120
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_none_or instead: `Some(5).is_none_or(func)`
121
121
122
- error: this `map_or` is redundant
122
+ error: this `map_or` can be simplified
123
123
--> tests/ui/unnecessary_map_or.rs:66:13
124
124
|
125
125
LL | let _ = r.map_or(false, |x| x == 8);
0 commit comments