1
- error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type
1
+ error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
2
2
--> $DIR/option_map_unit_fn_fixable.rs:38:5
3
3
|
4
4
LL | x.field.map(do_nothing);
@@ -8,135 +8,135 @@ LL | x.field.map(do_nothing);
8
8
|
9
9
= note: `-D clippy::option-map-unit-fn` implied by `-D warnings`
10
10
11
- error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type
11
+ error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
12
12
--> $DIR/option_map_unit_fn_fixable.rs:40:5
13
13
|
14
14
LL | x.field.map(do_nothing);
15
15
| ^^^^^^^^^^^^^^^^^^^^^^^-
16
16
| |
17
17
| help: try this: `if let Some(x_field) = x.field { do_nothing(x_field) }`
18
18
19
- error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type
19
+ error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
20
20
--> $DIR/option_map_unit_fn_fixable.rs:42:5
21
21
|
22
22
LL | x.field.map(diverge);
23
23
| ^^^^^^^^^^^^^^^^^^^^-
24
24
| |
25
25
| help: try this: `if let Some(x_field) = x.field { diverge(x_field) }`
26
26
27
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
27
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
28
28
--> $DIR/option_map_unit_fn_fixable.rs:48:5
29
29
|
30
30
LL | x.field.map(|value| x.do_option_nothing(value + captured));
31
31
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
32
32
| |
33
33
| help: try this: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }`
34
34
35
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
35
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
36
36
--> $DIR/option_map_unit_fn_fixable.rs:50:5
37
37
|
38
38
LL | x.field.map(|value| { x.do_option_plus_one(value + captured); });
39
39
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
40
40
| |
41
41
| help: try this: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }`
42
42
43
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
43
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
44
44
--> $DIR/option_map_unit_fn_fixable.rs:53:5
45
45
|
46
46
LL | x.field.map(|value| do_nothing(value + captured));
47
47
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
48
48
| |
49
49
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
50
50
51
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
51
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
52
52
--> $DIR/option_map_unit_fn_fixable.rs:55:5
53
53
|
54
54
LL | x.field.map(|value| { do_nothing(value + captured) });
55
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
56
56
| |
57
57
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
58
58
59
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
59
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
60
60
--> $DIR/option_map_unit_fn_fixable.rs:57:5
61
61
|
62
62
LL | x.field.map(|value| { do_nothing(value + captured); });
63
63
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
64
64
| |
65
65
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
66
66
67
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
67
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
68
68
--> $DIR/option_map_unit_fn_fixable.rs:59:5
69
69
|
70
70
LL | x.field.map(|value| { { do_nothing(value + captured); } });
71
71
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
72
72
| |
73
73
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
74
74
75
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
75
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
76
76
--> $DIR/option_map_unit_fn_fixable.rs:62:5
77
77
|
78
78
LL | x.field.map(|value| diverge(value + captured));
79
79
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
80
80
| |
81
81
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
82
82
83
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
83
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
84
84
--> $DIR/option_map_unit_fn_fixable.rs:64:5
85
85
|
86
86
LL | x.field.map(|value| { diverge(value + captured) });
87
87
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
88
88
| |
89
89
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
90
90
91
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
91
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
92
92
--> $DIR/option_map_unit_fn_fixable.rs:66:5
93
93
|
94
94
LL | x.field.map(|value| { diverge(value + captured); });
95
95
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
96
96
| |
97
97
| help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
98
98
99
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
99
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
100
100
--> $DIR/option_map_unit_fn_fixable.rs:68:5
101
101
|
102
102
LL | x.field.map(|value| { { diverge(value + captured); } });
103
103
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
104
104
| |
105
105
| help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
106
106
107
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
107
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
108
108
--> $DIR/option_map_unit_fn_fixable.rs:73:5
109
109
|
110
110
LL | x.field.map(|value| { let y = plus_one(value + captured); });
111
111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
112
112
| |
113
113
| help: try this: `if let Some(value) = x.field { let y = plus_one(value + captured); }`
114
114
115
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
115
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
116
116
--> $DIR/option_map_unit_fn_fixable.rs:75:5
117
117
|
118
118
LL | x.field.map(|value| { plus_one(value + captured); });
119
119
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
120
120
| |
121
121
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
122
122
123
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
123
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
124
124
--> $DIR/option_map_unit_fn_fixable.rs:77:5
125
125
|
126
126
LL | x.field.map(|value| { { plus_one(value + captured); } });
127
127
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
128
128
| |
129
129
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
130
130
131
- error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type
131
+ error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
132
132
--> $DIR/option_map_unit_fn_fixable.rs:80:5
133
133
|
134
134
LL | x.field.map(|ref value| { do_nothing(value + captured) });
135
135
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
136
136
| |
137
137
| help: try this: `if let Some(ref value) = x.field { do_nothing(value + captured) }`
138
138
139
- error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type
139
+ error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
140
140
--> $DIR/option_map_unit_fn_fixable.rs:82:5
141
141
|
142
142
LL | option().map(do_nothing);}
0 commit comments