Skip to content

Commit 1ca79a8

Browse files
committed
test fixes
1 parent 8e50cfa commit 1ca79a8

12 files changed

+152
-148
lines changed

tests/ui/manual_strip_fixable.fixed

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

34
fn main() {
45
let s = "abc";

tests/ui/manual_strip_fixable.rs

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

34
fn main() {
45
let s = "abc";

tests/ui/manual_strip_fixable.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: stripping a prefix manually
2-
--> tests/ui/manual_strip_fixable.rs:7:24
2+
--> tests/ui/manual_strip_fixable.rs:8:24
33
|
44
LL | let stripped = &s["ab".len()..];
55
| ^^^^^^^^^^^^^^^^
66
|
77
note: the prefix was tested here
8-
--> tests/ui/manual_strip_fixable.rs:6:5
8+
--> tests/ui/manual_strip_fixable.rs:7:5
99
|
1010
LL | if s.starts_with("ab") {
1111
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -19,13 +19,13 @@ LL ~ println!("{stripped}{}", stripped);
1919
|
2020

2121
error: stripping a suffix manually
22-
--> tests/ui/manual_strip_fixable.rs:13:24
22+
--> tests/ui/manual_strip_fixable.rs:14:24
2323
|
2424
LL | let stripped = &s[..s.len() - "bc".len()];
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2626
|
2727
note: the suffix was tested here
28-
--> tests/ui/manual_strip_fixable.rs:12:5
28+
--> tests/ui/manual_strip_fixable.rs:13:5
2929
|
3030
LL | if s.ends_with("bc") {
3131
| ^^^^^^^^^^^^^^^^^^^^^

tests/ui/needless_pass_by_ref_mut.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@no-rustfix
2-
31
#![allow(
42
clippy::if_same_then_else,
53
clippy::no_effect,
@@ -8,7 +6,7 @@
86
clippy::uninlined_format_args
97
)]
108
#![warn(clippy::needless_pass_by_ref_mut)]
11-
9+
//@no-rustfix
1210
use std::ptr::NonNull;
1311

1412
fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {

tests/ui/needless_pass_by_ref_mut.stderr

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this argument is a mutable reference, but not used mutably
2-
--> tests/ui/needless_pass_by_ref_mut.rs:14:11
2+
--> tests/ui/needless_pass_by_ref_mut.rs:12:11
33
|
44
LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
55
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>`
@@ -8,203 +8,203 @@ LL | fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
88
= help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_ref_mut)]`
99

1010
error: this argument is a mutable reference, but not used mutably
11-
--> tests/ui/needless_pass_by_ref_mut.rs:40:12
11+
--> tests/ui/needless_pass_by_ref_mut.rs:38:12
1212
|
1313
LL | fn foo6(s: &mut Vec<u32>) {
1414
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<u32>`
1515

1616
error: this argument is a mutable reference, but not used mutably
17-
--> tests/ui/needless_pass_by_ref_mut.rs:51:12
17+
--> tests/ui/needless_pass_by_ref_mut.rs:49:12
1818
|
1919
LL | fn bar(&mut self) {}
2020
| ^^^^^^^^^ help: consider changing to: `&self`
2121

2222
error: this argument is a mutable reference, but not used mutably
23-
--> tests/ui/needless_pass_by_ref_mut.rs:54:29
23+
--> tests/ui/needless_pass_by_ref_mut.rs:52:29
2424
|
2525
LL | fn mushroom(&self, vec: &mut Vec<i32>) -> usize {
2626
| ^^^^^^^^^^^^^ help: consider changing to: `&Vec<i32>`
2727

2828
error: this argument is a mutable reference, but not used mutably
29-
--> tests/ui/needless_pass_by_ref_mut.rs:132:16
29+
--> tests/ui/needless_pass_by_ref_mut.rs:130:16
3030
|
3131
LL | async fn a1(x: &mut i32) {
3232
| ^^^^^^^^ help: consider changing to: `&i32`
3333

3434
error: this argument is a mutable reference, but not used mutably
35-
--> tests/ui/needless_pass_by_ref_mut.rs:137:16
35+
--> tests/ui/needless_pass_by_ref_mut.rs:135:16
3636
|
3737
LL | async fn a2(x: &mut i32, y: String) {
3838
| ^^^^^^^^ help: consider changing to: `&i32`
3939

4040
error: this argument is a mutable reference, but not used mutably
41-
--> tests/ui/needless_pass_by_ref_mut.rs:142:16
41+
--> tests/ui/needless_pass_by_ref_mut.rs:140:16
4242
|
4343
LL | async fn a3(x: &mut i32, y: String, z: String) {
4444
| ^^^^^^^^ help: consider changing to: `&i32`
4545

4646
error: this argument is a mutable reference, but not used mutably
47-
--> tests/ui/needless_pass_by_ref_mut.rs:147:16
47+
--> tests/ui/needless_pass_by_ref_mut.rs:145:16
4848
|
4949
LL | async fn a4(x: &mut i32, y: i32) {
5050
| ^^^^^^^^ help: consider changing to: `&i32`
5151

5252
error: this argument is a mutable reference, but not used mutably
53-
--> tests/ui/needless_pass_by_ref_mut.rs:152:24
53+
--> tests/ui/needless_pass_by_ref_mut.rs:150:24
5454
|
5555
LL | async fn a5(x: i32, y: &mut i32) {
5656
| ^^^^^^^^ help: consider changing to: `&i32`
5757

5858
error: this argument is a mutable reference, but not used mutably
59-
--> tests/ui/needless_pass_by_ref_mut.rs:157:24
59+
--> tests/ui/needless_pass_by_ref_mut.rs:155:24
6060
|
6161
LL | async fn a6(x: i32, y: &mut i32) {
6262
| ^^^^^^^^ help: consider changing to: `&i32`
6363

6464
error: this argument is a mutable reference, but not used mutably
65-
--> tests/ui/needless_pass_by_ref_mut.rs:162:32
65+
--> tests/ui/needless_pass_by_ref_mut.rs:160:32
6666
|
6767
LL | async fn a7(x: i32, y: i32, z: &mut i32) {
6868
| ^^^^^^^^ help: consider changing to: `&i32`
6969

7070
error: this argument is a mutable reference, but not used mutably
71-
--> tests/ui/needless_pass_by_ref_mut.rs:167:24
71+
--> tests/ui/needless_pass_by_ref_mut.rs:165:24
7272
|
7373
LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
7474
| ^^^^^^^^ help: consider changing to: `&i32`
7575

7676
error: this argument is a mutable reference, but not used mutably
77-
--> tests/ui/needless_pass_by_ref_mut.rs:167:45
77+
--> tests/ui/needless_pass_by_ref_mut.rs:165:45
7878
|
7979
LL | async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
8080
| ^^^^^^^^ help: consider changing to: `&i32`
8181

8282
error: this argument is a mutable reference, but not used mutably
83-
--> tests/ui/needless_pass_by_ref_mut.rs:203:16
83+
--> tests/ui/needless_pass_by_ref_mut.rs:201:16
8484
|
8585
LL | fn cfg_warn(s: &mut u32) {}
8686
| ^^^^^^^^ help: consider changing to: `&u32`
8787
|
8888
= note: this is cfg-gated and may require further changes
8989

9090
error: this argument is a mutable reference, but not used mutably
91-
--> tests/ui/needless_pass_by_ref_mut.rs:208:20
91+
--> tests/ui/needless_pass_by_ref_mut.rs:206:20
9292
|
9393
LL | fn cfg_warn(s: &mut u32) {}
9494
| ^^^^^^^^ help: consider changing to: `&u32`
9595
|
9696
= note: this is cfg-gated and may require further changes
9797

9898
error: this argument is a mutable reference, but not used mutably
99-
--> tests/ui/needless_pass_by_ref_mut.rs:221:39
99+
--> tests/ui/needless_pass_by_ref_mut.rs:219:39
100100
|
101101
LL | async fn inner_async2(x: &mut i32, y: &mut u32) {
102102
| ^^^^^^^^ help: consider changing to: `&u32`
103103

104104
error: this argument is a mutable reference, but not used mutably
105-
--> tests/ui/needless_pass_by_ref_mut.rs:230:26
105+
--> tests/ui/needless_pass_by_ref_mut.rs:228:26
106106
|
107107
LL | async fn inner_async3(x: &mut i32, y: &mut u32) {
108108
| ^^^^^^^^ help: consider changing to: `&i32`
109109

110110
error: this argument is a mutable reference, but not used mutably
111-
--> tests/ui/needless_pass_by_ref_mut.rs:250:30
111+
--> tests/ui/needless_pass_by_ref_mut.rs:248:30
112112
|
113113
LL | async fn call_in_closure1(n: &mut str) {
114114
| ^^^^^^^^ help: consider changing to: `&str`
115115

116116
error: this argument is a mutable reference, but not used mutably
117-
--> tests/ui/needless_pass_by_ref_mut.rs:270:16
117+
--> tests/ui/needless_pass_by_ref_mut.rs:268:16
118118
|
119119
LL | fn closure2(n: &mut usize) -> impl '_ + FnMut() -> usize {
120120
| ^^^^^^^^^^ help: consider changing to: `&usize`
121121

122122
error: this argument is a mutable reference, but not used mutably
123-
--> tests/ui/needless_pass_by_ref_mut.rs:282:22
123+
--> tests/ui/needless_pass_by_ref_mut.rs:280:22
124124
|
125125
LL | async fn closure4(n: &mut usize) {
126126
| ^^^^^^^^^^ help: consider changing to: `&usize`
127127

128128
error: this argument is a mutable reference, but not used mutably
129-
--> tests/ui/needless_pass_by_ref_mut.rs:337:12
129+
--> tests/ui/needless_pass_by_ref_mut.rs:335:12
130130
|
131131
LL | fn bar(&mut self) {}
132132
| ^^^^^^^^^ help: consider changing to: `&self`
133133

134134
error: this argument is a mutable reference, but not used mutably
135-
--> tests/ui/needless_pass_by_ref_mut.rs:340:18
135+
--> tests/ui/needless_pass_by_ref_mut.rs:338:18
136136
|
137137
LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) {
138138
| ^^^^^^^^^ help: consider changing to: `&self`
139139

140140
error: this argument is a mutable reference, but not used mutably
141-
--> tests/ui/needless_pass_by_ref_mut.rs:340:45
141+
--> tests/ui/needless_pass_by_ref_mut.rs:338:45
142142
|
143143
LL | async fn foo(&mut self, u: &mut i32, v: &mut u32) {
144144
| ^^^^^^^^ help: consider changing to: `&u32`
145145

146146
error: this argument is a mutable reference, but not used mutably
147-
--> tests/ui/needless_pass_by_ref_mut.rs:349:46
147+
--> tests/ui/needless_pass_by_ref_mut.rs:347:46
148148
|
149149
LL | async fn foo2(&mut self, u: &mut i32, v: &mut u32) {
150150
| ^^^^^^^^ help: consider changing to: `&u32`
151151

152152
error: this argument is a mutable reference, but not used mutably
153-
--> tests/ui/needless_pass_by_ref_mut.rs:366:18
153+
--> tests/ui/needless_pass_by_ref_mut.rs:364:18
154154
|
155155
LL | fn _empty_tup(x: &mut (())) {}
156156
| ^^^^^^^^^ help: consider changing to: `&()`
157157

158158
error: this argument is a mutable reference, but not used mutably
159-
--> tests/ui/needless_pass_by_ref_mut.rs:368:19
159+
--> tests/ui/needless_pass_by_ref_mut.rs:366:19
160160
|
161161
LL | fn _single_tup(x: &mut ((i32,))) {}
162162
| ^^^^^^^^^^^^^ help: consider changing to: `&(i32,)`
163163

164164
error: this argument is a mutable reference, but not used mutably
165-
--> tests/ui/needless_pass_by_ref_mut.rs:370:18
165+
--> tests/ui/needless_pass_by_ref_mut.rs:368:18
166166
|
167167
LL | fn _multi_tup(x: &mut ((i32, u32))) {}
168168
| ^^^^^^^^^^^^^^^^^ help: consider changing to: `&(i32, u32)`
169169

170170
error: this argument is a mutable reference, but not used mutably
171-
--> tests/ui/needless_pass_by_ref_mut.rs:372:11
171+
--> tests/ui/needless_pass_by_ref_mut.rs:370:11
172172
|
173173
LL | fn _fn(x: &mut (fn())) {}
174174
| ^^^^^^^^^^^ help: consider changing to: `&fn()`
175175

176176
error: this argument is a mutable reference, but not used mutably
177-
--> tests/ui/needless_pass_by_ref_mut.rs:375:23
177+
--> tests/ui/needless_pass_by_ref_mut.rs:373:23
178178
|
179179
LL | fn _extern_rust_fn(x: &mut extern "Rust" fn()) {}
180180
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "Rust" fn()`
181181

182182
error: this argument is a mutable reference, but not used mutably
183-
--> tests/ui/needless_pass_by_ref_mut.rs:377:20
183+
--> tests/ui/needless_pass_by_ref_mut.rs:375:20
184184
|
185185
LL | fn _extern_c_fn(x: &mut extern "C" fn()) {}
186186
| ^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&extern "C" fn()`
187187

188188
error: this argument is a mutable reference, but not used mutably
189-
--> tests/ui/needless_pass_by_ref_mut.rs:379:18
189+
--> tests/ui/needless_pass_by_ref_mut.rs:377:18
190190
|
191191
LL | fn _unsafe_fn(x: &mut unsafe fn()) {}
192192
| ^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe fn()`
193193

194194
error: this argument is a mutable reference, but not used mutably
195-
--> tests/ui/needless_pass_by_ref_mut.rs:381:25
195+
--> tests/ui/needless_pass_by_ref_mut.rs:379:25
196196
|
197197
LL | fn _unsafe_extern_fn(x: &mut unsafe extern "C" fn()) {}
198198
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn()`
199199

200200
error: this argument is a mutable reference, but not used mutably
201-
--> tests/ui/needless_pass_by_ref_mut.rs:383:20
201+
--> tests/ui/needless_pass_by_ref_mut.rs:381:20
202202
|
203203
LL | fn _fn_with_arg(x: &mut unsafe extern "C" fn(i32)) {}
204204
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn(i32)`
205205

206206
error: this argument is a mutable reference, but not used mutably
207-
--> tests/ui/needless_pass_by_ref_mut.rs:385:20
207+
--> tests/ui/needless_pass_by_ref_mut.rs:383:20
208208
|
209209
LL | fn _fn_with_ret(x: &mut unsafe extern "C" fn() -> (i32)) {}
210210
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&unsafe extern "C" fn() -> (i32)`

tests/ui/unnecessary_os_str_debug_formatting.rs

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

34
use std::ffi::{OsStr, OsString};
45

tests/ui/unnecessary_os_str_debug_formatting.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unnecessary `Debug` formatting in `println!` args
2-
--> tests/ui/unnecessary_os_str_debug_formatting.rs:14:22
2+
--> tests/ui/unnecessary_os_str_debug_formatting.rs:15:22
33
|
44
LL | println!("{:?}", os_str);
55
| ^^^^^^
@@ -10,7 +10,7 @@ LL | println!("{:?}", os_str);
1010
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_debug_formatting)]`
1111

1212
error: unnecessary `Debug` formatting in `println!` args
13-
--> tests/ui/unnecessary_os_str_debug_formatting.rs:15:22
13+
--> tests/ui/unnecessary_os_str_debug_formatting.rs:16:22
1414
|
1515
LL | println!("{:?}", os_string);
1616
| ^^^^^^^^^
@@ -19,7 +19,7 @@ LL | println!("{:?}", os_string);
1919
= note: switching to `Display` formatting will change how the value is shown; escaped characters will no longer be escaped and surrounding quotes will be removed
2020

2121
error: unnecessary `Debug` formatting in `println!` args
22-
--> tests/ui/unnecessary_os_str_debug_formatting.rs:17:16
22+
--> tests/ui/unnecessary_os_str_debug_formatting.rs:18:16
2323
|
2424
LL | println!("{os_str:?}");
2525
| ^^^^^^
@@ -28,7 +28,7 @@ LL | println!("{os_str:?}");
2828
= note: switching to `Display` formatting will change how the value is shown; escaped characters will no longer be escaped and surrounding quotes will be removed
2929

3030
error: unnecessary `Debug` formatting in `println!` args
31-
--> tests/ui/unnecessary_os_str_debug_formatting.rs:18:16
31+
--> tests/ui/unnecessary_os_str_debug_formatting.rs:19:16
3232
|
3333
LL | println!("{os_string:?}");
3434
| ^^^^^^^^^
@@ -37,7 +37,7 @@ LL | println!("{os_string:?}");
3737
= note: switching to `Display` formatting will change how the value is shown; escaped characters will no longer be escaped and surrounding quotes will be removed
3838

3939
error: unnecessary `Debug` formatting in `format!` args
40-
--> tests/ui/unnecessary_os_str_debug_formatting.rs:20:37
40+
--> tests/ui/unnecessary_os_str_debug_formatting.rs:21:37
4141
|
4242
LL | let _: String = format!("{:?}", os_str);
4343
| ^^^^^^
@@ -46,7 +46,7 @@ LL | let _: String = format!("{:?}", os_str);
4646
= note: switching to `Display` formatting will change how the value is shown; escaped characters will no longer be escaped and surrounding quotes will be removed
4747

4848
error: unnecessary `Debug` formatting in `format!` args
49-
--> tests/ui/unnecessary_os_str_debug_formatting.rs:21:37
49+
--> tests/ui/unnecessary_os_str_debug_formatting.rs:22:37
5050
|
5151
LL | let _: String = format!("{:?}", os_string);
5252
| ^^^^^^^^^

tests/ui/unnecessary_path_debug_formatting.rs

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

34
use std::ffi::{OsStr, OsString};
45
use std::ops::Deref;

0 commit comments

Comments
 (0)