Skip to content

Commit 2018dbf

Browse files
committed
fallout: allow new uninlined_format_args in tests
in order to switch `clippy::uninlined_format_args` from pedantic to style, all existing tests must not raise a warning. I did not want to change the actual tests, so this is a relatively minor change that: * normalizes all allow/deny/warn attributes * all allow attributes are grouped together * sorted alphabetically * the `clippy::*` attributes are listed separate from the other ones. * deny and warn attributes are listed before the allowed ones * minor spelling rename - "moveable" -> "movable"
1 parent 9aa85dc commit 2018dbf

File tree

185 files changed

+1046
-1013
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+1046
-1013
lines changed

tests/ui-toml/conf_deprecated_key/conf_deprecated_key.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::uninlined_format_args)]
2+
13
fn main() {}
24

35
#[warn(clippy::cognitive_complexity)]

tests/ui-toml/conf_deprecated_key/conf_deprecated_key.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ warning: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecate
33
warning: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecated field `blacklisted-names`. Please use `disallowed-names` instead
44

55
error: the function has a cognitive complexity of (3/2)
6-
--> $DIR/conf_deprecated_key.rs:4:4
6+
--> $DIR/conf_deprecated_key.rs:6:4
77
|
88
LL | fn cognitive_complexity() {
99
| ^^^^^^^^^^^^^^^^^^^^

tests/ui/assertions_on_result_states.fixed

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::assertions_on_result_states)]
3+
#![allow(clippy::uninlined_format_args)]
34

45
use std::result::Result;
56

@@ -46,10 +47,10 @@ fn main() {
4647

4748
// test ok that shouldn't be moved
4849
let r: Result<CopyFoo, DebugFoo> = Ok(CopyFoo);
49-
fn test_ref_unmoveable_ok(r: &Result<CopyFoo, DebugFoo>) {
50+
fn test_ref_unmovable_ok(r: &Result<CopyFoo, DebugFoo>) {
5051
assert!(r.is_ok());
5152
}
52-
test_ref_unmoveable_ok(&r);
53+
test_ref_unmovable_ok(&r);
5354
assert!(r.is_ok());
5455
r.unwrap();
5556

tests/ui/assertions_on_result_states.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![warn(clippy::assertions_on_result_states)]
3+
#![allow(clippy::uninlined_format_args)]
34

45
use std::result::Result;
56

@@ -46,10 +47,10 @@ fn main() {
4647

4748
// test ok that shouldn't be moved
4849
let r: Result<CopyFoo, DebugFoo> = Ok(CopyFoo);
49-
fn test_ref_unmoveable_ok(r: &Result<CopyFoo, DebugFoo>) {
50+
fn test_ref_unmovable_ok(r: &Result<CopyFoo, DebugFoo>) {
5051
assert!(r.is_ok());
5152
}
52-
test_ref_unmoveable_ok(&r);
53+
test_ref_unmovable_ok(&r);
5354
assert!(r.is_ok());
5455
r.unwrap();
5556

tests/ui/assertions_on_result_states.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
error: called `assert!` with `Result::is_ok`
2-
--> $DIR/assertions_on_result_states.rs:24:5
2+
--> $DIR/assertions_on_result_states.rs:25:5
33
|
44
LL | assert!(r.is_ok());
55
| ^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap()`
66
|
77
= note: `-D clippy::assertions-on-result-states` implied by `-D warnings`
88

99
error: called `assert!` with `Result::is_ok`
10-
--> $DIR/assertions_on_result_states.rs:42:5
10+
--> $DIR/assertions_on_result_states.rs:43:5
1111
|
1212
LL | assert!(get_ok().is_ok());
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `get_ok().unwrap()`
1414

1515
error: called `assert!` with `Result::is_ok`
16-
--> $DIR/assertions_on_result_states.rs:45:5
16+
--> $DIR/assertions_on_result_states.rs:46:5
1717
|
1818
LL | assert!(get_ok_macro!().is_ok());
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `get_ok_macro!().unwrap()`
2020

2121
error: called `assert!` with `Result::is_ok`
22-
--> $DIR/assertions_on_result_states.rs:58:5
22+
--> $DIR/assertions_on_result_states.rs:59:5
2323
|
2424
LL | assert!(r.is_ok());
2525
| ^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap()`
2626

2727
error: called `assert!` with `Result::is_ok`
28-
--> $DIR/assertions_on_result_states.rs:64:9
28+
--> $DIR/assertions_on_result_states.rs:65:9
2929
|
3030
LL | assert!(r.is_ok());
3131
| ^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap()`
3232

3333
error: called `assert!` with `Result::is_err`
34-
--> $DIR/assertions_on_result_states.rs:72:5
34+
--> $DIR/assertions_on_result_states.rs:73:5
3535
|
3636
LL | assert!(r.is_err());
3737
| ^^^^^^^^^^^^^^^^^^^ help: replace with: `r.unwrap_err()`
3838

3939
error: called `assert!` with `Result::is_err`
40-
--> $DIR/assertions_on_result_states.rs:82:5
40+
--> $DIR/assertions_on_result_states.rs:83:5
4141
|
4242
LL | assert!(res.is_err())
4343
| ^^^^^^^^^^^^^^^^^^^^^ help: replace with: `res.unwrap_err();`

tests/ui/assign_ops2.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::uninlined_format_args)]
2+
13
#[allow(unused_assignments)]
24
#[warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)]
35
fn main() {

tests/ui/assign_ops2.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: variable appears on both sides of an assignment operation
2-
--> $DIR/assign_ops2.rs:5:5
2+
--> $DIR/assign_ops2.rs:7:5
33
|
44
LL | a += a + 1;
55
| ^^^^^^^^^^
@@ -15,7 +15,7 @@ LL | a = a + a + 1;
1515
| ~~~~~~~~~~~~~
1616

1717
error: variable appears on both sides of an assignment operation
18-
--> $DIR/assign_ops2.rs:6:5
18+
--> $DIR/assign_ops2.rs:8:5
1919
|
2020
LL | a += 1 + a;
2121
| ^^^^^^^^^^
@@ -30,7 +30,7 @@ LL | a = a + 1 + a;
3030
| ~~~~~~~~~~~~~
3131

3232
error: variable appears on both sides of an assignment operation
33-
--> $DIR/assign_ops2.rs:7:5
33+
--> $DIR/assign_ops2.rs:9:5
3434
|
3535
LL | a -= a - 1;
3636
| ^^^^^^^^^^
@@ -45,7 +45,7 @@ LL | a = a - (a - 1);
4545
| ~~~~~~~~~~~~~~~
4646

4747
error: variable appears on both sides of an assignment operation
48-
--> $DIR/assign_ops2.rs:8:5
48+
--> $DIR/assign_ops2.rs:10:5
4949
|
5050
LL | a *= a * 99;
5151
| ^^^^^^^^^^^
@@ -60,7 +60,7 @@ LL | a = a * a * 99;
6060
| ~~~~~~~~~~~~~~
6161

6262
error: variable appears on both sides of an assignment operation
63-
--> $DIR/assign_ops2.rs:9:5
63+
--> $DIR/assign_ops2.rs:11:5
6464
|
6565
LL | a *= 42 * a;
6666
| ^^^^^^^^^^^
@@ -75,7 +75,7 @@ LL | a = a * 42 * a;
7575
| ~~~~~~~~~~~~~~
7676

7777
error: variable appears on both sides of an assignment operation
78-
--> $DIR/assign_ops2.rs:10:5
78+
--> $DIR/assign_ops2.rs:12:5
7979
|
8080
LL | a /= a / 2;
8181
| ^^^^^^^^^^
@@ -90,7 +90,7 @@ LL | a = a / (a / 2);
9090
| ~~~~~~~~~~~~~~~
9191

9292
error: variable appears on both sides of an assignment operation
93-
--> $DIR/assign_ops2.rs:11:5
93+
--> $DIR/assign_ops2.rs:13:5
9494
|
9595
LL | a %= a % 5;
9696
| ^^^^^^^^^^
@@ -105,7 +105,7 @@ LL | a = a % (a % 5);
105105
| ~~~~~~~~~~~~~~~
106106

107107
error: variable appears on both sides of an assignment operation
108-
--> $DIR/assign_ops2.rs:12:5
108+
--> $DIR/assign_ops2.rs:14:5
109109
|
110110
LL | a &= a & 1;
111111
| ^^^^^^^^^^
@@ -120,7 +120,7 @@ LL | a = a & a & 1;
120120
| ~~~~~~~~~~~~~
121121

122122
error: variable appears on both sides of an assignment operation
123-
--> $DIR/assign_ops2.rs:13:5
123+
--> $DIR/assign_ops2.rs:15:5
124124
|
125125
LL | a *= a * a;
126126
| ^^^^^^^^^^
@@ -135,7 +135,7 @@ LL | a = a * a * a;
135135
| ~~~~~~~~~~~~~
136136

137137
error: manual implementation of an assign operation
138-
--> $DIR/assign_ops2.rs:50:5
138+
--> $DIR/assign_ops2.rs:52:5
139139
|
140140
LL | buf = buf + cows.clone();
141141
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()`

tests/ui/auxiliary/proc_macro_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![crate_type = "proc-macro"]
55
#![feature(repr128, proc_macro_hygiene, proc_macro_quote, box_patterns)]
66
#![allow(incomplete_features)]
7-
#![allow(clippy::useless_conversion)]
7+
#![allow(clippy::useless_conversion, clippy::uninlined_format_args)]
88

99
extern crate proc_macro;
1010
extern crate quote;

tests/ui/bind_instead_of_map.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![deny(clippy::bind_instead_of_map)]
3+
#![allow(clippy::uninlined_format_args)]
34

45
// need a main anyway, use it get rid of unused warnings too
56
pub fn main() {

tests/ui/bind_instead_of_map.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#![deny(clippy::bind_instead_of_map)]
3+
#![allow(clippy::uninlined_format_args)]
34

45
// need a main anyway, use it get rid of unused warnings too
56
pub fn main() {

tests/ui/bind_instead_of_map.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: using `Option.and_then(Some)`, which is a no-op
2-
--> $DIR/bind_instead_of_map.rs:8:13
2+
--> $DIR/bind_instead_of_map.rs:9:13
33
|
44
LL | let _ = x.and_then(Some);
55
| ^^^^^^^^^^^^^^^^ help: use the expression directly: `x`
@@ -11,13 +11,13 @@ LL | #![deny(clippy::bind_instead_of_map)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
14-
--> $DIR/bind_instead_of_map.rs:9:13
14+
--> $DIR/bind_instead_of_map.rs:10:13
1515
|
1616
LL | let _ = x.and_then(|o| Some(o + 1));
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `x.map(|o| o + 1)`
1818

1919
error: using `Result.and_then(Ok)`, which is a no-op
20-
--> $DIR/bind_instead_of_map.rs:15:13
20+
--> $DIR/bind_instead_of_map.rs:16:13
2121
|
2222
LL | let _ = x.and_then(Ok);
2323
| ^^^^^^^^^^^^^^ help: use the expression directly: `x`

tests/ui/borrow_box.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![deny(clippy::borrowed_box)]
2-
#![allow(clippy::disallowed_names)]
3-
#![allow(unused_variables)]
4-
#![allow(dead_code)]
2+
#![allow(dead_code, unused_variables)]
3+
#![allow(clippy::uninlined_format_args, clippy::disallowed_names)]
54

65
use std::fmt::Display;
76

tests/ui/borrow_box.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2-
--> $DIR/borrow_box.rs:21:14
2+
--> $DIR/borrow_box.rs:20:14
33
|
44
LL | let foo: &Box<bool>;
55
| ^^^^^^^^^^ help: try: `&bool`
@@ -11,55 +11,55 @@ LL | #![deny(clippy::borrowed_box)]
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
14-
--> $DIR/borrow_box.rs:25:10
14+
--> $DIR/borrow_box.rs:24:10
1515
|
1616
LL | foo: &'a Box<bool>,
1717
| ^^^^^^^^^^^^^ help: try: `&'a bool`
1818

1919
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
20-
--> $DIR/borrow_box.rs:29:17
20+
--> $DIR/borrow_box.rs:28:17
2121
|
2222
LL | fn test4(a: &Box<bool>);
2323
| ^^^^^^^^^^ help: try: `&bool`
2424

2525
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
26-
--> $DIR/borrow_box.rs:95:25
26+
--> $DIR/borrow_box.rs:94:25
2727
|
2828
LL | pub fn test14(_display: &Box<dyn Display>) {}
2929
| ^^^^^^^^^^^^^^^^^ help: try: `&dyn Display`
3030

3131
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
32-
--> $DIR/borrow_box.rs:96:25
32+
--> $DIR/borrow_box.rs:95:25
3333
|
3434
LL | pub fn test15(_display: &Box<dyn Display + Send>) {}
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
3636

3737
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
38-
--> $DIR/borrow_box.rs:97:29
38+
--> $DIR/borrow_box.rs:96:29
3939
|
4040
LL | pub fn test16<'a>(_display: &'a Box<dyn Display + 'a>) {}
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (dyn Display + 'a)`
4242

4343
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
44-
--> $DIR/borrow_box.rs:99:25
44+
--> $DIR/borrow_box.rs:98:25
4545
|
4646
LL | pub fn test17(_display: &Box<impl Display>) {}
4747
| ^^^^^^^^^^^^^^^^^^ help: try: `&impl Display`
4848

4949
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
50-
--> $DIR/borrow_box.rs:100:25
50+
--> $DIR/borrow_box.rs:99:25
5151
|
5252
LL | pub fn test18(_display: &Box<impl Display + Send>) {}
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(impl Display + Send)`
5454

5555
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
56-
--> $DIR/borrow_box.rs:101:29
56+
--> $DIR/borrow_box.rs:100:29
5757
|
5858
LL | pub fn test19<'a>(_display: &'a Box<impl Display + 'a>) {}
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (impl Display + 'a)`
6060

6161
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
62-
--> $DIR/borrow_box.rs:106:25
62+
--> $DIR/borrow_box.rs:105:25
6363
|
6464
LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {}
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`

tests/ui/branches_sharing_code/shared_at_bottom.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#![allow(dead_code, clippy::equatable_if_let)]
21
#![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
2+
#![allow(dead_code)]
3+
#![allow(clippy::equatable_if_let, clippy::uninlined_format_args)]
34

45
// This tests the branches_sharing_code lint at the end of blocks
56

@@ -11,10 +12,10 @@ fn simple_examples() {
1112
let start_value = 0;
1213
println!("=^.^=");
1314

14-
// Same but not moveable due to `start_value`
15+
// Same but not movable due to `start_value`
1516
let _ = start_value;
1617

17-
// The rest is self contained and moveable => Only lint the rest
18+
// The rest is self contained and movable => Only lint the rest
1819
let result = false;
1920
println!("Block end!");
2021
result
@@ -23,10 +24,10 @@ fn simple_examples() {
2324
let start_value = 8;
2425
println!("xD");
2526

26-
// Same but not moveable due to `start_value`
27+
// Same but not movable due to `start_value`
2728
let _ = start_value;
2829

29-
// The rest is self contained and moveable => Only lint the rest
30+
// The rest is self contained and movable => Only lint the rest
3031
let result = false;
3132
println!("Block end!");
3233
result
@@ -55,15 +56,15 @@ fn simple_examples() {
5556
println!("I'm a local because I use the value `z`: `{}`", z);
5657

5758
println!(
58-
"I'm moveable because I know: `outer_scope_value`: '{}'",
59+
"I'm movable because I know: `outer_scope_value`: '{}'",
5960
outer_scope_value
6061
);
6162
} else {
6263
let z = 45678000;
6364
println!("I'm a local because I use the value `z`: `{}`", z);
6465

6566
println!(
66-
"I'm moveable because I know: `outer_scope_value`: '{}'",
67+
"I'm movable because I know: `outer_scope_value`: '{}'",
6768
outer_scope_value
6869
);
6970
}
@@ -110,7 +111,7 @@ fn simple_but_suggestion_is_invalid() {
110111
}
111112

112113
/// Tests where the blocks are not linted due to the used value scope
113-
fn not_moveable_due_to_value_scope() {
114+
fn not_movable_due_to_value_scope() {
114115
let x = 18;
115116

116117
// Using a local value in the moved code

0 commit comments

Comments
 (0)