]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/map_unit_fn.stderr
New upstream version 1.27.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / map_unit_fn.stderr
1 error: called `map(f)` on an Option value where `f` is a unit function
2 --> $DIR/map_unit_fn.rs:33:5
3 |
4 33 | x.field.map(do_nothing);
5 | ^^^^^^^^^^^^^^^^^^^^^^^-
6 | |
7 | help: try this: `if let Some(x_field) = x.field { do_nothing(...) }`
8 |
9 = note: `-D option-map-unit-fn` implied by `-D warnings`
10
11 error: called `map(f)` on an Option value where `f` is a unit function
12 --> $DIR/map_unit_fn.rs:35:5
13 |
14 35 | x.field.map(do_nothing);
15 | ^^^^^^^^^^^^^^^^^^^^^^^-
16 | |
17 | help: try this: `if let Some(x_field) = x.field { do_nothing(...) }`
18
19 error: called `map(f)` on an Option value where `f` is a unit function
20 --> $DIR/map_unit_fn.rs:37:5
21 |
22 37 | x.field.map(diverge);
23 | ^^^^^^^^^^^^^^^^^^^^-
24 | |
25 | help: try this: `if let Some(x_field) = x.field { diverge(...) }`
26
27 error: called `map(f)` on an Option value where `f` is a unit closure
28 --> $DIR/map_unit_fn.rs:43:5
29 |
30 43 | x.field.map(|value| x.do_option_nothing(value + captured));
31 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
32 | |
33 | help: try this: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }`
34
35 error: called `map(f)` on an Option value where `f` is a unit closure
36 --> $DIR/map_unit_fn.rs:45:5
37 |
38 45 | x.field.map(|value| { x.do_option_plus_one(value + captured); });
39 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
40 | |
41 | help: try this: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }`
42
43 error: called `map(f)` on an Option value where `f` is a unit closure
44 --> $DIR/map_unit_fn.rs:48:5
45 |
46 48 | x.field.map(|value| do_nothing(value + captured));
47 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
48 | |
49 | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
50
51 error: called `map(f)` on an Option value where `f` is a unit closure
52 --> $DIR/map_unit_fn.rs:50:5
53 |
54 50 | x.field.map(|value| { do_nothing(value + captured) });
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
56 | |
57 | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
58
59 error: called `map(f)` on an Option value where `f` is a unit closure
60 --> $DIR/map_unit_fn.rs:52:5
61 |
62 52 | x.field.map(|value| { do_nothing(value + captured); });
63 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
64 | |
65 | help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
66
67 error: called `map(f)` on an Option value where `f` is a unit closure
68 --> $DIR/map_unit_fn.rs:54:5
69 |
70 54 | x.field.map(|value| { { do_nothing(value + captured); } });
71 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
72 | |
73 | help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
74
75 error: called `map(f)` on an Option value where `f` is a unit closure
76 --> $DIR/map_unit_fn.rs:57:5
77 |
78 57 | x.field.map(|value| diverge(value + captured));
79 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
80 | |
81 | help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
82
83 error: called `map(f)` on an Option value where `f` is a unit closure
84 --> $DIR/map_unit_fn.rs:59:5
85 |
86 59 | x.field.map(|value| { diverge(value + captured) });
87 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
88 | |
89 | help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
90
91 error: called `map(f)` on an Option value where `f` is a unit closure
92 --> $DIR/map_unit_fn.rs:61:5
93 |
94 61 | x.field.map(|value| { diverge(value + captured); });
95 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
96 | |
97 | help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
98
99 error: called `map(f)` on an Option value where `f` is a unit closure
100 --> $DIR/map_unit_fn.rs:63:5
101 |
102 63 | x.field.map(|value| { { diverge(value + captured); } });
103 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
104 | |
105 | help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
106
107 error: called `map(f)` on an Option value where `f` is a unit closure
108 --> $DIR/map_unit_fn.rs:68:5
109 |
110 68 | x.field.map(|value| { let y = plus_one(value + captured); });
111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
112 | |
113 | help: try this: `if let Some(value) = x.field { let y = plus_one(value + captured); }`
114
115 error: called `map(f)` on an Option value where `f` is a unit closure
116 --> $DIR/map_unit_fn.rs:70:5
117 |
118 70 | x.field.map(|value| { plus_one(value + captured); });
119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
120 | |
121 | help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
122
123 error: called `map(f)` on an Option value where `f` is a unit closure
124 --> $DIR/map_unit_fn.rs:72:5
125 |
126 72 | x.field.map(|value| { { plus_one(value + captured); } });
127 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
128 | |
129 | help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
130
131 error: called `map(f)` on an Option value where `f` is a unit closure
132 --> $DIR/map_unit_fn.rs:75:5
133 |
134 75 | x.field.map(|ref value| { do_nothing(value + captured) });
135 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
136 | |
137 | help: try this: `if let Some(ref value) = x.field { do_nothing(value + captured) }`
138
139 error: called `map(f)` on an Option value where `f` is a unit closure
140 --> $DIR/map_unit_fn.rs:78:5
141 |
142 78 | x.field.map(|value| { do_nothing(value); do_nothing(value) });
143 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
144 | |
145 | help: try this: `if let Some(value) = x.field { ... }`
146
147 error: called `map(f)` on an Option value where `f` is a unit closure
148 --> $DIR/map_unit_fn.rs:80:5
149 |
150 80 | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
151 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
152 | |
153 | help: try this: `if let Some(value) = x.field { ... }`
154
155 error: called `map(f)` on an Option value where `f` is a unit closure
156 --> $DIR/map_unit_fn.rs:84:5
157 |
158 84 | x.field.map(|value| {
159 | _____^
160 | |_____|
161 | ||
162 85 | || do_nothing(value);
163 86 | || do_nothing(value)
164 87 | || });
165 | ||______^- help: try this: `if let Some(value) = x.field { ... }`
166 | |_______|
167 |
168
169 error: called `map(f)` on an Option value where `f` is a unit closure
170 --> $DIR/map_unit_fn.rs:88:5
171 |
172 88 | x.field.map(|value| { do_nothing(value); do_nothing(value); });
173 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
174 | |
175 | help: try this: `if let Some(value) = x.field { ... }`
176
177 error: called `map(f)` on an Option value where `f` is a unit function
178 --> $DIR/map_unit_fn.rs:91:5
179 |
180 91 | Some(42).map(diverge);
181 | ^^^^^^^^^^^^^^^^^^^^^-
182 | |
183 | help: try this: `if let Some(_) = Some(42) { diverge(...) }`
184
185 error: called `map(f)` on an Option value where `f` is a unit function
186 --> $DIR/map_unit_fn.rs:92:5
187 |
188 92 | "12".parse::<i32>().ok().map(diverge);
189 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
190 | |
191 | help: try this: `if let Some(_) = "12".parse::<i32>().ok() { diverge(...) }`
192
193 error: called `map(f)` on an Option value where `f` is a unit function
194 --> $DIR/map_unit_fn.rs:93:5
195 |
196 93 | Some(plus_one(1)).map(do_nothing);
197 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
198 | |
199 | help: try this: `if let Some(_) = Some(plus_one(1)) { do_nothing(...) }`
200
201 error: called `map(f)` on an Option value where `f` is a unit function
202 --> $DIR/map_unit_fn.rs:97:5
203 |
204 97 | y.map(do_nothing);
205 | ^^^^^^^^^^^^^^^^^-
206 | |
207 | help: try this: `if let Some(_y) = y { do_nothing(...) }`
208
209 error: aborting due to 25 previous errors
210