Skip to content

Commit 762448b

Browse files
Update ui tests
1 parent 6955a8a commit 762448b

7 files changed

+55
-51
lines changed

tests/ui/multiple_bound_locations.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ struct C<F>(F);
5050

5151
impl<F> C<F> {
5252
fn foo(_f: F) -> Self
53-
where F: std::fmt::Display
53+
where
54+
F: std::fmt::Display,
5455
{
55-
todo!()
56+
todo!()
5657
}
5758
}
5859

tests/ui/trait_duplication_in_bounds_unfixable.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![deny(clippy::trait_duplication_in_bounds)]
2+
#![allow(clippy::multiple_bound_locations)]
23

34
use std::collections::BTreeMap;
45
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};

tests/ui/trait_duplication_in_bounds_unfixable.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this trait bound is already specified in the where clause
2-
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:6:15
2+
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:7:15
33
|
44
LL | fn bad_foo<T: Clone + Default, Z: Copy>(arg0: T, arg1: Z)
55
| ^^^^^
@@ -12,55 +12,55 @@ LL | #![deny(clippy::trait_duplication_in_bounds)]
1212
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1313

1414
error: this trait bound is already specified in the where clause
15-
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:6:23
15+
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:7:23
1616
|
1717
LL | fn bad_foo<T: Clone + Default, Z: Copy>(arg0: T, arg1: Z)
1818
| ^^^^^^^
1919
|
2020
= help: consider removing this trait bound
2121

2222
error: this trait bound is already specified in trait declaration
23-
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:37:15
23+
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:38:15
2424
|
2525
LL | Self: Default;
2626
| ^^^^^^^
2727
|
2828
= help: consider removing this trait bound
2929

3030
error: this trait bound is already specified in trait declaration
31-
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:52:15
31+
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:53:15
3232
|
3333
LL | Self: Default + Clone;
3434
| ^^^^^^^
3535
|
3636
= help: consider removing this trait bound
3737

3838
error: this trait bound is already specified in trait declaration
39-
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:59:15
39+
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:60:15
4040
|
4141
LL | Self: Default + Clone;
4242
| ^^^^^^^
4343
|
4444
= help: consider removing this trait bound
4545

4646
error: this trait bound is already specified in trait declaration
47-
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:59:25
47+
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:60:25
4848
|
4949
LL | Self: Default + Clone;
5050
| ^^^^^
5151
|
5252
= help: consider removing this trait bound
5353

5454
error: this trait bound is already specified in trait declaration
55-
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:64:15
55+
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:65:15
5656
|
5757
LL | Self: Default;
5858
| ^^^^^^^
5959
|
6060
= help: consider removing this trait bound
6161

6262
error: this trait bound is already specified in trait declaration
63-
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:100:15
63+
--> tests/ui/trait_duplication_in_bounds_unfixable.rs:101:15
6464
|
6565
LL | Self: Iterator<Item = Foo>,
6666
| ^^^^^^^^^^^^^^^^^^^^

tests/ui/type_repetition_in_bounds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![deny(clippy::type_repetition_in_bounds)]
2-
#![allow(clippy::extra_unused_type_parameters)]
2+
#![allow(clippy::extra_unused_type_parameters, clippy::multiple_bound_locations)]
33

44
use serde::Deserialize;
55
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};

tests/ui/unnecessary_cast.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![warn(clippy::unnecessary_cast)]
33
#![allow(
44
clippy::borrow_as_ptr,
5+
clippy::multiple_bound_locations,
56
clippy::no_effect,
67
clippy::nonstandard_macro_braces,
78
clippy::unnecessary_operation,

tests/ui/unnecessary_cast.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![warn(clippy::unnecessary_cast)]
33
#![allow(
44
clippy::borrow_as_ptr,
5+
clippy::multiple_bound_locations,
56
clippy::no_effect,
67
clippy::nonstandard_macro_braces,
78
clippy::unnecessary_operation,

tests/ui/unnecessary_cast.stderr

+40-40
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: casting raw pointers to the same type and constness is unnecessary (`*const T` -> `*const T`)
2-
--> tests/ui/unnecessary_cast.rs:18:5
2+
--> tests/ui/unnecessary_cast.rs:19:5
33
|
44
LL | ptr as *const T
55
| ^^^^^^^^^^^^^^^ help: try: `ptr`
@@ -8,235 +8,235 @@ LL | ptr as *const T
88
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_cast)]`
99

1010
error: casting integer literal to `i32` is unnecessary
11-
--> tests/ui/unnecessary_cast.rs:53:5
11+
--> tests/ui/unnecessary_cast.rs:54:5
1212
|
1313
LL | 1i32 as i32;
1414
| ^^^^^^^^^^^ help: try: `1_i32`
1515

1616
error: casting float literal to `f32` is unnecessary
17-
--> tests/ui/unnecessary_cast.rs:54:5
17+
--> tests/ui/unnecessary_cast.rs:55:5
1818
|
1919
LL | 1f32 as f32;
2020
| ^^^^^^^^^^^ help: try: `1_f32`
2121

2222
error: casting to the same type is unnecessary (`bool` -> `bool`)
23-
--> tests/ui/unnecessary_cast.rs:55:5
23+
--> tests/ui/unnecessary_cast.rs:56:5
2424
|
2525
LL | false as bool;
2626
| ^^^^^^^^^^^^^ help: try: `false`
2727

2828
error: casting integer literal to `i32` is unnecessary
29-
--> tests/ui/unnecessary_cast.rs:58:5
29+
--> tests/ui/unnecessary_cast.rs:59:5
3030
|
3131
LL | -1_i32 as i32;
3232
| ^^^^^^^^^^^^^ help: try: `-1_i32`
3333

3434
error: casting integer literal to `i32` is unnecessary
35-
--> tests/ui/unnecessary_cast.rs:59:5
35+
--> tests/ui/unnecessary_cast.rs:60:5
3636
|
3737
LL | - 1_i32 as i32;
3838
| ^^^^^^^^^^^^^^ help: try: `- 1_i32`
3939

4040
error: casting float literal to `f32` is unnecessary
41-
--> tests/ui/unnecessary_cast.rs:60:5
41+
--> tests/ui/unnecessary_cast.rs:61:5
4242
|
4343
LL | -1f32 as f32;
4444
| ^^^^^^^^^^^^ help: try: `-1_f32`
4545

4646
error: casting integer literal to `i32` is unnecessary
47-
--> tests/ui/unnecessary_cast.rs:61:5
47+
--> tests/ui/unnecessary_cast.rs:62:5
4848
|
4949
LL | 1_i32 as i32;
5050
| ^^^^^^^^^^^^ help: try: `1_i32`
5151

5252
error: casting float literal to `f32` is unnecessary
53-
--> tests/ui/unnecessary_cast.rs:62:5
53+
--> tests/ui/unnecessary_cast.rs:63:5
5454
|
5555
LL | 1_f32 as f32;
5656
| ^^^^^^^^^^^^ help: try: `1_f32`
5757

5858
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
59-
--> tests/ui/unnecessary_cast.rs:64:22
59+
--> tests/ui/unnecessary_cast.rs:65:22
6060
|
6161
LL | let _: *mut u8 = [1u8, 2].as_ptr() as *const u8 as *mut u8;
6262
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
6363

6464
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
65-
--> tests/ui/unnecessary_cast.rs:66:5
65+
--> tests/ui/unnecessary_cast.rs:67:5
6666
|
6767
LL | [1u8, 2].as_ptr() as *const u8;
6868
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_ptr()`
6969

7070
error: casting raw pointers to the same type and constness is unnecessary (`*mut u8` -> `*mut u8`)
71-
--> tests/ui/unnecessary_cast.rs:68:5
71+
--> tests/ui/unnecessary_cast.rs:69:5
7272
|
7373
LL | [1u8, 2].as_mut_ptr() as *mut u8;
7474
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `[1u8, 2].as_mut_ptr()`
7575

7676
error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
77-
--> tests/ui/unnecessary_cast.rs:79:5
77+
--> tests/ui/unnecessary_cast.rs:80:5
7878
|
7979
LL | owo::<u32>([1u32].as_ptr()) as *const u32;
8080
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `owo::<u32>([1u32].as_ptr())`
8181

8282
error: casting raw pointers to the same type and constness is unnecessary (`*const u8` -> `*const u8`)
83-
--> tests/ui/unnecessary_cast.rs:80:5
83+
--> tests/ui/unnecessary_cast.rs:81:5
8484
|
8585
LL | uwu::<u32, u8>([1u32].as_ptr()) as *const u8;
8686
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u8>([1u32].as_ptr())`
8787

8888
error: casting raw pointers to the same type and constness is unnecessary (`*const u32` -> `*const u32`)
89-
--> tests/ui/unnecessary_cast.rs:82:5
89+
--> tests/ui/unnecessary_cast.rs:83:5
9090
|
9191
LL | uwu::<u32, u32>([1u32].as_ptr()) as *const u32;
9292
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `uwu::<u32, u32>([1u32].as_ptr())`
9393

9494
error: casting to the same type is unnecessary (`u32` -> `u32`)
95-
--> tests/ui/unnecessary_cast.rs:117:5
95+
--> tests/ui/unnecessary_cast.rs:118:5
9696
|
9797
LL | aaa() as u32;
9898
| ^^^^^^^^^^^^ help: try: `aaa()`
9999

100100
error: casting to the same type is unnecessary (`u32` -> `u32`)
101-
--> tests/ui/unnecessary_cast.rs:119:5
101+
--> tests/ui/unnecessary_cast.rs:120:5
102102
|
103103
LL | aaa() as u32;
104104
| ^^^^^^^^^^^^ help: try: `aaa()`
105105

106106
error: casting integer literal to `f32` is unnecessary
107-
--> tests/ui/unnecessary_cast.rs:155:9
107+
--> tests/ui/unnecessary_cast.rs:156:9
108108
|
109109
LL | 100 as f32;
110110
| ^^^^^^^^^^ help: try: `100_f32`
111111

112112
error: casting integer literal to `f64` is unnecessary
113-
--> tests/ui/unnecessary_cast.rs:156:9
113+
--> tests/ui/unnecessary_cast.rs:157:9
114114
|
115115
LL | 100 as f64;
116116
| ^^^^^^^^^^ help: try: `100_f64`
117117

118118
error: casting integer literal to `f64` is unnecessary
119-
--> tests/ui/unnecessary_cast.rs:157:9
119+
--> tests/ui/unnecessary_cast.rs:158:9
120120
|
121121
LL | 100_i32 as f64;
122122
| ^^^^^^^^^^^^^^ help: try: `100_f64`
123123

124124
error: casting integer literal to `f32` is unnecessary
125-
--> tests/ui/unnecessary_cast.rs:158:17
125+
--> tests/ui/unnecessary_cast.rs:159:17
126126
|
127127
LL | let _ = -100 as f32;
128128
| ^^^^^^^^^^^ help: try: `-100_f32`
129129

130130
error: casting integer literal to `f64` is unnecessary
131-
--> tests/ui/unnecessary_cast.rs:159:17
131+
--> tests/ui/unnecessary_cast.rs:160:17
132132
|
133133
LL | let _ = -100 as f64;
134134
| ^^^^^^^^^^^ help: try: `-100_f64`
135135

136136
error: casting integer literal to `f64` is unnecessary
137-
--> tests/ui/unnecessary_cast.rs:160:17
137+
--> tests/ui/unnecessary_cast.rs:161:17
138138
|
139139
LL | let _ = -100_i32 as f64;
140140
| ^^^^^^^^^^^^^^^ help: try: `-100_f64`
141141

142142
error: casting float literal to `f32` is unnecessary
143-
--> tests/ui/unnecessary_cast.rs:161:9
143+
--> tests/ui/unnecessary_cast.rs:162:9
144144
|
145145
LL | 100. as f32;
146146
| ^^^^^^^^^^^ help: try: `100_f32`
147147

148148
error: casting float literal to `f64` is unnecessary
149-
--> tests/ui/unnecessary_cast.rs:162:9
149+
--> tests/ui/unnecessary_cast.rs:163:9
150150
|
151151
LL | 100. as f64;
152152
| ^^^^^^^^^^^ help: try: `100_f64`
153153

154154
error: casting integer literal to `u32` is unnecessary
155-
--> tests/ui/unnecessary_cast.rs:174:9
155+
--> tests/ui/unnecessary_cast.rs:175:9
156156
|
157157
LL | 1 as u32;
158158
| ^^^^^^^^ help: try: `1_u32`
159159

160160
error: casting integer literal to `i32` is unnecessary
161-
--> tests/ui/unnecessary_cast.rs:175:9
161+
--> tests/ui/unnecessary_cast.rs:176:9
162162
|
163163
LL | 0x10 as i32;
164164
| ^^^^^^^^^^^ help: try: `0x10_i32`
165165

166166
error: casting integer literal to `usize` is unnecessary
167-
--> tests/ui/unnecessary_cast.rs:176:9
167+
--> tests/ui/unnecessary_cast.rs:177:9
168168
|
169169
LL | 0b10 as usize;
170170
| ^^^^^^^^^^^^^ help: try: `0b10_usize`
171171

172172
error: casting integer literal to `u16` is unnecessary
173-
--> tests/ui/unnecessary_cast.rs:177:9
173+
--> tests/ui/unnecessary_cast.rs:178:9
174174
|
175175
LL | 0o73 as u16;
176176
| ^^^^^^^^^^^ help: try: `0o73_u16`
177177

178178
error: casting integer literal to `u32` is unnecessary
179-
--> tests/ui/unnecessary_cast.rs:178:9
179+
--> tests/ui/unnecessary_cast.rs:179:9
180180
|
181181
LL | 1_000_000_000 as u32;
182182
| ^^^^^^^^^^^^^^^^^^^^ help: try: `1_000_000_000_u32`
183183

184184
error: casting float literal to `f64` is unnecessary
185-
--> tests/ui/unnecessary_cast.rs:180:9
185+
--> tests/ui/unnecessary_cast.rs:181:9
186186
|
187187
LL | 1.0 as f64;
188188
| ^^^^^^^^^^ help: try: `1.0_f64`
189189

190190
error: casting float literal to `f32` is unnecessary
191-
--> tests/ui/unnecessary_cast.rs:181:9
191+
--> tests/ui/unnecessary_cast.rs:182:9
192192
|
193193
LL | 0.5 as f32;
194194
| ^^^^^^^^^^ help: try: `0.5_f32`
195195

196196
error: casting integer literal to `i32` is unnecessary
197-
--> tests/ui/unnecessary_cast.rs:185:17
197+
--> tests/ui/unnecessary_cast.rs:186:17
198198
|
199199
LL | let _ = -1 as i32;
200200
| ^^^^^^^^^ help: try: `-1_i32`
201201

202202
error: casting float literal to `f32` is unnecessary
203-
--> tests/ui/unnecessary_cast.rs:186:17
203+
--> tests/ui/unnecessary_cast.rs:187:17
204204
|
205205
LL | let _ = -1.0 as f32;
206206
| ^^^^^^^^^^^ help: try: `-1.0_f32`
207207

208208
error: casting to the same type is unnecessary (`i32` -> `i32`)
209-
--> tests/ui/unnecessary_cast.rs:192:18
209+
--> tests/ui/unnecessary_cast.rs:193:18
210210
|
211211
LL | let _ = &(x as i32);
212212
| ^^^^^^^^^^ help: try: `{ x }`
213213

214214
error: casting integer literal to `i32` is unnecessary
215-
--> tests/ui/unnecessary_cast.rs:198:22
215+
--> tests/ui/unnecessary_cast.rs:199:22
216216
|
217217
LL | let _: i32 = -(1) as i32;
218218
| ^^^^^^^^^^^ help: try: `-1_i32`
219219

220220
error: casting integer literal to `i64` is unnecessary
221-
--> tests/ui/unnecessary_cast.rs:200:22
221+
--> tests/ui/unnecessary_cast.rs:201:22
222222
|
223223
LL | let _: i64 = -(1) as i64;
224224
| ^^^^^^^^^^^ help: try: `-1_i64`
225225

226226
error: casting float literal to `f64` is unnecessary
227-
--> tests/ui/unnecessary_cast.rs:207:22
227+
--> tests/ui/unnecessary_cast.rs:208:22
228228
|
229229
LL | let _: f64 = (-8.0 as f64).exp();
230230
| ^^^^^^^^^^^^^ help: try: `(-8.0_f64)`
231231

232232
error: casting float literal to `f64` is unnecessary
233-
--> tests/ui/unnecessary_cast.rs:209:23
233+
--> tests/ui/unnecessary_cast.rs:210:23
234234
|
235235
LL | let _: f64 = -(8.0 as f64).exp(); // should suggest `-8.0_f64.exp()` here not to change code behavior
236236
| ^^^^^^^^^^^^ help: try: `8.0_f64`
237237

238238
error: casting to the same type is unnecessary (`f32` -> `f32`)
239-
--> tests/ui/unnecessary_cast.rs:217:20
239+
--> tests/ui/unnecessary_cast.rs:218:20
240240
|
241241
LL | let _num = foo() as f32;
242242
| ^^^^^^^^^^^^ help: try: `foo()`

0 commit comments

Comments
 (0)