11error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
2- --> tests/ui/option_map_unit_fn_fixable.rs:37 :5
2+ --> tests/ui/option_map_unit_fn_fixable.rs:36 :5
33 |
44LL | x.field.map(do_nothing);
55 | ^^^^^^^^^^^^^^^^^^^^^^^-
@@ -10,159 +10,159 @@ LL | x.field.map(do_nothing);
1010 = help: to override `-D warnings` add `#[allow(clippy::option_map_unit_fn)]`
1111
1212error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
13- --> tests/ui/option_map_unit_fn_fixable.rs:40 :5
13+ --> tests/ui/option_map_unit_fn_fixable.rs:39 :5
1414 |
1515LL | x.field.map(do_nothing);
1616 | ^^^^^^^^^^^^^^^^^^^^^^^-
1717 | |
1818 | help: try: `if let Some(x_field) = x.field { do_nothing(x_field) }`
1919
2020error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
21- --> tests/ui/option_map_unit_fn_fixable.rs:43 :5
21+ --> tests/ui/option_map_unit_fn_fixable.rs:42 :5
2222 |
2323LL | x.field.map(diverge);
2424 | ^^^^^^^^^^^^^^^^^^^^-
2525 | |
2626 | help: try: `if let Some(x_field) = x.field { diverge(x_field) }`
2727
2828error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
29- --> tests/ui/option_map_unit_fn_fixable.rs:50 :5
29+ --> tests/ui/option_map_unit_fn_fixable.rs:49 :5
3030 |
3131LL | x.field.map(|value| x.do_option_nothing(value + captured));
3232 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
3333 | |
3434 | help: try: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }`
3535
3636error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
37- --> tests/ui/option_map_unit_fn_fixable.rs:53 :5
37+ --> tests/ui/option_map_unit_fn_fixable.rs:52 :5
3838 |
3939LL | x.field.map(|value| { x.do_option_plus_one(value + captured); });
4040 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
4141 | |
4242 | help: try: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }`
4343
4444error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
45- --> tests/ui/option_map_unit_fn_fixable.rs:57 :5
45+ --> tests/ui/option_map_unit_fn_fixable.rs:56 :5
4646 |
4747LL | x.field.map(|value| do_nothing(value + captured));
4848 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
4949 | |
5050 | help: try: `if let Some(value) = x.field { do_nothing(value + captured) }`
5151
5252error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
53- --> tests/ui/option_map_unit_fn_fixable.rs:60 :5
53+ --> tests/ui/option_map_unit_fn_fixable.rs:59 :5
5454 |
5555LL | x.field.map(|value| { do_nothing(value + captured) });
5656 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
5757 | |
5858 | help: try: `if let Some(value) = x.field { do_nothing(value + captured) }`
5959
6060error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
61- --> tests/ui/option_map_unit_fn_fixable.rs:63 :5
61+ --> tests/ui/option_map_unit_fn_fixable.rs:62 :5
6262 |
6363LL | x.field.map(|value| { do_nothing(value + captured); });
6464 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
6565 | |
6666 | help: try: `if let Some(value) = x.field { do_nothing(value + captured); }`
6767
6868error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
69- --> tests/ui/option_map_unit_fn_fixable.rs:66 :5
69+ --> tests/ui/option_map_unit_fn_fixable.rs:65 :5
7070 |
7171LL | x.field.map(|value| { { do_nothing(value + captured); } });
7272 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
7373 | |
7474 | help: try: `if let Some(value) = x.field { do_nothing(value + captured); }`
7575
7676error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
77- --> tests/ui/option_map_unit_fn_fixable.rs:70 :5
77+ --> tests/ui/option_map_unit_fn_fixable.rs:69 :5
7878 |
7979LL | x.field.map(|value| diverge(value + captured));
8080 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
8181 | |
8282 | help: try: `if let Some(value) = x.field { diverge(value + captured) }`
8383
8484error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
85- --> tests/ui/option_map_unit_fn_fixable.rs:73 :5
85+ --> tests/ui/option_map_unit_fn_fixable.rs:72 :5
8686 |
8787LL | x.field.map(|value| { diverge(value + captured) });
8888 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
8989 | |
9090 | help: try: `if let Some(value) = x.field { diverge(value + captured) }`
9191
9292error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
93- --> tests/ui/option_map_unit_fn_fixable.rs:76 :5
93+ --> tests/ui/option_map_unit_fn_fixable.rs:75 :5
9494 |
9595LL | x.field.map(|value| { diverge(value + captured); });
9696 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
9797 | |
9898 | help: try: `if let Some(value) = x.field { diverge(value + captured); }`
9999
100100error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
101- --> tests/ui/option_map_unit_fn_fixable.rs:79 :5
101+ --> tests/ui/option_map_unit_fn_fixable.rs:78 :5
102102 |
103103LL | x.field.map(|value| { { diverge(value + captured); } });
104104 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
105105 | |
106106 | help: try: `if let Some(value) = x.field { diverge(value + captured); }`
107107
108108error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
109- --> tests/ui/option_map_unit_fn_fixable.rs:85 :5
109+ --> tests/ui/option_map_unit_fn_fixable.rs:84 :5
110110 |
111111LL | x.field.map(|value| { let y = plus_one(value + captured); });
112112 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
113113 | |
114114 | help: try: `if let Some(value) = x.field { let y = plus_one(value + captured); }`
115115
116116error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
117- --> tests/ui/option_map_unit_fn_fixable.rs:88 :5
117+ --> tests/ui/option_map_unit_fn_fixable.rs:87 :5
118118 |
119119LL | x.field.map(|value| { plus_one(value + captured); });
120120 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
121121 | |
122122 | help: try: `if let Some(value) = x.field { plus_one(value + captured); }`
123123
124124error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
125- --> tests/ui/option_map_unit_fn_fixable.rs:91 :5
125+ --> tests/ui/option_map_unit_fn_fixable.rs:90 :5
126126 |
127127LL | x.field.map(|value| { { plus_one(value + captured); } });
128128 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
129129 | |
130130 | help: try: `if let Some(value) = x.field { plus_one(value + captured); }`
131131
132132error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
133- --> tests/ui/option_map_unit_fn_fixable.rs:95 :5
133+ --> tests/ui/option_map_unit_fn_fixable.rs:94 :5
134134 |
135135LL | x.field.map(|ref value| { do_nothing(value + captured) });
136136 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
137137 | |
138138 | help: try: `if let Some(ref value) = x.field { do_nothing(value + captured) }`
139139
140140error: called `map(f)` on an `Option` value where `f` is a function that returns the unit type `()`
141- --> tests/ui/option_map_unit_fn_fixable.rs:98 :5
141+ --> tests/ui/option_map_unit_fn_fixable.rs:97 :5
142142 |
143143LL | option().map(do_nothing);
144144 | ^^^^^^^^^^^^^^^^^^^^^^^^-
145145 | |
146146 | help: try: `if let Some(a) = option() { do_nothing(a) }`
147147
148148error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
149- --> tests/ui/option_map_unit_fn_fixable.rs:101 :5
149+ --> tests/ui/option_map_unit_fn_fixable.rs:100 :5
150150 |
151- LL | option().map(|value| println!("{:?}", value ));
152- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -
151+ LL | option().map(|value| println!("{value :?}"));
152+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
153153 | |
154- | help: try: `if let Some(value) = option() { println!("{:?}", value ) }`
154+ | help: try: `if let Some(value) = option() { println!("{value :?}") }`
155155
156156error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
157- --> tests/ui/option_map_unit_fn_fixable.rs:108 :5
157+ --> tests/ui/option_map_unit_fn_fixable.rs:107 :5
158158 |
159159LL | x.map(|x| unsafe { f(x) });
160160 | ^^^^^^^^^^^^^^^^^^^^^^^^^^-
161161 | |
162162 | help: try: `if let Some(x) = x { unsafe { f(x) } }`
163163
164164error: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
165- --> tests/ui/option_map_unit_fn_fixable.rs:110 :5
165+ --> tests/ui/option_map_unit_fn_fixable.rs:109 :5
166166 |
167167LL | x.map(|x| unsafe { { f(x) } });
168168 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
0 commit comments