Skip to content

Commit 4463ba7

Browse files
committed
clean-up tests
1 parent 1ecb18a commit 4463ba7

10 files changed

+64
-70
lines changed

tests/ui/option_map_unit_fn_fixable.fixed

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![warn(clippy::option_map_unit_fn)]
2-
#![allow(unused)]
3-
#![allow(clippy::uninlined_format_args, clippy::unnecessary_wraps)]
2+
#![expect(clippy::unnecessary_wraps)]
43

54
fn do_nothing<T>(_: T) {}
65

@@ -98,7 +97,7 @@ fn option_map_unit_fn() {
9897
if let Some(a) = option() { do_nothing(a) }
9998
//~^ option_map_unit_fn
10099

101-
if let Some(value) = option() { println!("{:?}", value) }
100+
if let Some(value) = option() { println!("{value:?}") }
102101
//~^ option_map_unit_fn
103102
}
104103

tests/ui/option_map_unit_fn_fixable.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![warn(clippy::option_map_unit_fn)]
2-
#![allow(unused)]
3-
#![allow(clippy::uninlined_format_args, clippy::unnecessary_wraps)]
2+
#![expect(clippy::unnecessary_wraps)]
43

54
fn do_nothing<T>(_: T) {}
65

@@ -98,7 +97,7 @@ fn option_map_unit_fn() {
9897
option().map(do_nothing);
9998
//~^ option_map_unit_fn
10099

101-
option().map(|value| println!("{:?}", value));
100+
option().map(|value| println!("{value:?}"));
102101
//~^ option_map_unit_fn
103102
}
104103

tests/ui/option_map_unit_fn_fixable.stderr

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: 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
|
44
LL | 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

1212
error: 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
|
1515
LL | x.field.map(do_nothing);
1616
| ^^^^^^^^^^^^^^^^^^^^^^^-
1717
| |
1818
| help: try: `if let Some(x_field) = x.field { do_nothing(x_field) }`
1919

2020
error: 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
|
2323
LL | x.field.map(diverge);
2424
| ^^^^^^^^^^^^^^^^^^^^-
2525
| |
2626
| help: try: `if let Some(x_field) = x.field { diverge(x_field) }`
2727

2828
error: 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
|
3131
LL | 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

3636
error: 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
|
3939
LL | 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

4444
error: 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
|
4747
LL | x.field.map(|value| do_nothing(value + captured));
4848
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
4949
| |
5050
| help: try: `if let Some(value) = x.field { do_nothing(value + captured) }`
5151

5252
error: 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
|
5555
LL | x.field.map(|value| { do_nothing(value + captured) });
5656
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
5757
| |
5858
| help: try: `if let Some(value) = x.field { do_nothing(value + captured) }`
5959

6060
error: 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
|
6363
LL | x.field.map(|value| { do_nothing(value + captured); });
6464
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
6565
| |
6666
| help: try: `if let Some(value) = x.field { do_nothing(value + captured); }`
6767

6868
error: 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
|
7171
LL | x.field.map(|value| { { do_nothing(value + captured); } });
7272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
7373
| |
7474
| help: try: `if let Some(value) = x.field { do_nothing(value + captured); }`
7575

7676
error: 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
|
7979
LL | x.field.map(|value| diverge(value + captured));
8080
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
8181
| |
8282
| help: try: `if let Some(value) = x.field { diverge(value + captured) }`
8383

8484
error: 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
|
8787
LL | x.field.map(|value| { diverge(value + captured) });
8888
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
8989
| |
9090
| help: try: `if let Some(value) = x.field { diverge(value + captured) }`
9191

9292
error: 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
|
9595
LL | x.field.map(|value| { diverge(value + captured); });
9696
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
9797
| |
9898
| help: try: `if let Some(value) = x.field { diverge(value + captured); }`
9999

100100
error: 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
|
103103
LL | x.field.map(|value| { { diverge(value + captured); } });
104104
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
105105
| |
106106
| help: try: `if let Some(value) = x.field { diverge(value + captured); }`
107107

108108
error: 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
|
111111
LL | 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

116116
error: 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
|
119119
LL | x.field.map(|value| { plus_one(value + captured); });
120120
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
121121
| |
122122
| help: try: `if let Some(value) = x.field { plus_one(value + captured); }`
123123

124124
error: 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
|
127127
LL | x.field.map(|value| { { plus_one(value + captured); } });
128128
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
129129
| |
130130
| help: try: `if let Some(value) = x.field { plus_one(value + captured); }`
131131

132132
error: 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
|
135135
LL | 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

140140
error: 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
|
143143
LL | option().map(do_nothing);
144144
| ^^^^^^^^^^^^^^^^^^^^^^^^-
145145
| |
146146
| help: try: `if let Some(a) = option() { do_nothing(a) }`
147147

148148
error: 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

156156
error: 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
|
159159
LL | x.map(|x| unsafe { f(x) });
160160
| ^^^^^^^^^^^^^^^^^^^^^^^^^^-
161161
| |
162162
| help: try: `if let Some(x) = x { unsafe { f(x) } }`
163163

164164
error: 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
|
167167
LL | x.map(|x| unsafe { { f(x) } });
168168
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-

tests/ui/option_map_unit_fn_unfixable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![warn(clippy::option_map_unit_fn)]
2-
#![allow(unused)]
32

43
fn do_nothing<T>(_: T) {}
54

tests/ui/option_map_unit_fn_unfixable.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error[E0425]: cannot find value `x` in this scope
2-
--> tests/ui/option_map_unit_fn_unfixable.rs:17:5
2+
--> tests/ui/option_map_unit_fn_unfixable.rs:16:5
33
|
44
LL | x.field.map(|value| { do_nothing(value); do_nothing(value) });
55
| ^ not found in this scope
66

77
error[E0425]: cannot find value `x` in this scope
8-
--> tests/ui/option_map_unit_fn_unfixable.rs:20:5
8+
--> tests/ui/option_map_unit_fn_unfixable.rs:19:5
99
|
1010
LL | x.field.map(|value| if value > 0 { do_nothing(value); do_nothing(value) });
1111
| ^ not found in this scope
1212

1313
error[E0425]: cannot find value `x` in this scope
14-
--> tests/ui/option_map_unit_fn_unfixable.rs:25:5
14+
--> tests/ui/option_map_unit_fn_unfixable.rs:24:5
1515
|
1616
LL | x.field.map(|value| {
1717
| ^ not found in this scope
1818

1919
error[E0425]: cannot find value `x` in this scope
20-
--> tests/ui/option_map_unit_fn_unfixable.rs:30:5
20+
--> tests/ui/option_map_unit_fn_unfixable.rs:29:5
2121
|
2222
LL | x.field.map(|value| { do_nothing(value); do_nothing(value); });
2323
| ^ not found in this scope

tests/ui/result_map_unit_fn_fixable.fixed

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#![warn(clippy::result_map_unit_fn)]
2-
#![allow(unused)]
3-
#![allow(clippy::uninlined_format_args)]
42

53
fn do_nothing<T>(_: T) {}
64

@@ -92,7 +90,7 @@ fn result_map_unit_fn() {
9290
if let Ok(ref value) = x.field { do_nothing(value + captured) }
9391
//~^ result_map_unit_fn
9492

95-
if let Ok(value) = x.field { println!("{:?}", value) }
93+
if let Ok(value) = x.field { println!("{value:?}") }
9694
//~^ result_map_unit_fn
9795
}
9896

tests/ui/result_map_unit_fn_fixable.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#![warn(clippy::result_map_unit_fn)]
2-
#![allow(unused)]
3-
#![allow(clippy::uninlined_format_args)]
42

53
fn do_nothing<T>(_: T) {}
64

@@ -92,7 +90,7 @@ fn result_map_unit_fn() {
9290
x.field.map(|ref value| { do_nothing(value + captured) });
9391
//~^ result_map_unit_fn
9492

95-
x.field.map(|value| println!("{:?}", value));
93+
x.field.map(|value| println!("{value:?}"));
9694
//~^ result_map_unit_fn
9795
}
9896

0 commit comments

Comments
 (0)