Skip to content

Commit

Permalink
Auto merge of #9547 - nyurik:capt, r=flip1995
Browse files Browse the repository at this point in the history
fallout: fix tests to allow uninlined_format_args

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:

* add `#![allow(clippy::uninlined_format_args)]` where needed
* 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

See also #9233, #9525, #9527

cc: `@llogiq` `@Alexendoo`

changelog: none
  • Loading branch information
bors committed Oct 4, 2022
2 parents e8c1b54 + eb39702 commit 2f90b2a
Show file tree
Hide file tree
Showing 181 changed files with 1,021 additions and 984 deletions.
2 changes: 2 additions & 0 deletions tests/ui-toml/conf_deprecated_key/conf_deprecated_key.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]

fn main() {}

#[warn(clippy::cognitive_complexity)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ warning: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecate
warning: error reading Clippy's configuration file `$DIR/clippy.toml`: deprecated field `blacklisted-names`. Please use `disallowed-names` instead

error: the function has a cognitive complexity of (3/2)
--> $DIR/conf_deprecated_key.rs:4:4
--> $DIR/conf_deprecated_key.rs:6:4
|
LL | fn cognitive_complexity() {
| ^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/assign_ops2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::uninlined_format_args)]

#[allow(unused_assignments)]
#[warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)]
fn main() {
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/assign_ops2.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:5:5
--> $DIR/assign_ops2.rs:7:5
|
LL | a += a + 1;
| ^^^^^^^^^^
Expand All @@ -15,7 +15,7 @@ LL | a = a + a + 1;
| ~~~~~~~~~~~~~

error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:6:5
--> $DIR/assign_ops2.rs:8:5
|
LL | a += 1 + a;
| ^^^^^^^^^^
Expand All @@ -30,7 +30,7 @@ LL | a = a + 1 + a;
| ~~~~~~~~~~~~~

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

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

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

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

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

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

error: variable appears on both sides of an assignment operation
--> $DIR/assign_ops2.rs:13:5
--> $DIR/assign_ops2.rs:15:5
|
LL | a *= a * a;
| ^^^^^^^^^^
Expand All @@ -135,7 +135,7 @@ LL | a = a * a * a;
| ~~~~~~~~~~~~~

error: manual implementation of an assign operation
--> $DIR/assign_ops2.rs:50:5
--> $DIR/assign_ops2.rs:52:5
|
LL | buf = buf + cows.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/auxiliary/proc_macro_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![crate_type = "proc-macro"]
#![feature(repr128, proc_macro_hygiene, proc_macro_quote, box_patterns)]
#![allow(incomplete_features)]
#![allow(clippy::useless_conversion)]
#![allow(clippy::useless_conversion, clippy::uninlined_format_args)]

extern crate proc_macro;
extern crate quote;
Expand Down
1 change: 1 addition & 0 deletions tests/ui/bind_instead_of_map.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// run-rustfix
#![deny(clippy::bind_instead_of_map)]
#![allow(clippy::uninlined_format_args)]

// need a main anyway, use it get rid of unused warnings too
pub fn main() {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/bind_instead_of_map.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// run-rustfix
#![deny(clippy::bind_instead_of_map)]
#![allow(clippy::uninlined_format_args)]

// need a main anyway, use it get rid of unused warnings too
pub fn main() {
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/bind_instead_of_map.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: using `Option.and_then(Some)`, which is a no-op
--> $DIR/bind_instead_of_map.rs:8:13
--> $DIR/bind_instead_of_map.rs:9:13
|
LL | let _ = x.and_then(Some);
| ^^^^^^^^^^^^^^^^ help: use the expression directly: `x`
Expand All @@ -11,13 +11,13 @@ LL | #![deny(clippy::bind_instead_of_map)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

error: using `Result.and_then(Ok)`, which is a no-op
--> $DIR/bind_instead_of_map.rs:15:13
--> $DIR/bind_instead_of_map.rs:16:13
|
LL | let _ = x.and_then(Ok);
| ^^^^^^^^^^^^^^ help: use the expression directly: `x`
Expand Down
5 changes: 2 additions & 3 deletions tests/ui/borrow_box.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![deny(clippy::borrowed_box)]
#![allow(clippy::disallowed_names)]
#![allow(unused_variables)]
#![allow(dead_code)]
#![allow(dead_code, unused_variables)]
#![allow(clippy::uninlined_format_args, clippy::disallowed_names)]

use std::fmt::Display;

Expand Down
20 changes: 10 additions & 10 deletions tests/ui/borrow_box.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:21:14
--> $DIR/borrow_box.rs:20:14
|
LL | let foo: &Box<bool>;
| ^^^^^^^^^^ help: try: `&bool`
Expand All @@ -11,55 +11,55 @@ LL | #![deny(clippy::borrowed_box)]
| ^^^^^^^^^^^^^^^^^^^^

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

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

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

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

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

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

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

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

error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
--> $DIR/borrow_box.rs:106:25
--> $DIR/borrow_box.rs:105:25
|
LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/branches_sharing_code/shared_at_bottom.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![allow(dead_code, clippy::equatable_if_let)]
#![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
#![allow(dead_code)]
#![allow(clippy::equatable_if_let, clippy::uninlined_format_args)]

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

Expand Down
20 changes: 10 additions & 10 deletions tests/ui/branches_sharing_code/shared_at_bottom.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:30:5
--> $DIR/shared_at_bottom.rs:31:5
|
LL | / let result = false;
LL | | println!("Block end!");
Expand All @@ -8,7 +8,7 @@ LL | | };
| |_____^
|
note: the lint level is defined here
--> $DIR/shared_at_bottom.rs:2:36
--> $DIR/shared_at_bottom.rs:1:36
|
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -22,7 +22,7 @@ LL ~ result;
|

error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:48:5
--> $DIR/shared_at_bottom.rs:49:5
|
LL | / println!("Same end of block");
LL | | }
Expand All @@ -35,7 +35,7 @@ LL + println!("Same end of block");
|

error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:65:5
--> $DIR/shared_at_bottom.rs:66:5
|
LL | / println!(
LL | | "I'm moveable because I know: `outer_scope_value`: '{}'",
Expand All @@ -54,7 +54,7 @@ LL + );
|

error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:77:9
--> $DIR/shared_at_bottom.rs:78:9
|
LL | / println!("Hello World");
LL | | }
Expand All @@ -67,7 +67,7 @@ LL + println!("Hello World");
|

error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:93:5
--> $DIR/shared_at_bottom.rs:94:5
|
LL | / let later_used_value = "A string value";
LL | | println!("{}", later_used_value);
Expand All @@ -84,7 +84,7 @@ LL + println!("{}", later_used_value);
|

error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:106:5
--> $DIR/shared_at_bottom.rs:107:5
|
LL | / let simple_examples = "I now identify as a &str :)";
LL | | println!("This is the new simple_example: {}", simple_examples);
Expand All @@ -100,7 +100,7 @@ LL + println!("This is the new simple_example: {}", simple_examples);
|

error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:171:5
--> $DIR/shared_at_bottom.rs:172:5
|
LL | / x << 2
LL | | };
Expand All @@ -114,7 +114,7 @@ LL ~ x << 2;
|

error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:178:5
--> $DIR/shared_at_bottom.rs:179:5
|
LL | / x * 4
LL | | }
Expand All @@ -128,7 +128,7 @@ LL + x * 4
|

error: all if blocks contain the same code at the end
--> $DIR/shared_at_bottom.rs:190:44
--> $DIR/shared_at_bottom.rs:191:44
|
LL | if x == 17 { b = 1; a = 0x99; } else { a = 0x99; }
| ^^^^^^^^^^^
Expand Down
5 changes: 3 additions & 2 deletions tests/ui/branches_sharing_code/shared_at_top.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![allow(dead_code, clippy::mixed_read_write_in_expression)]
#![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
#![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
#![allow(dead_code)]
#![allow(clippy::mixed_read_write_in_expression, clippy::uninlined_format_args)]

// This tests the branches_sharing_code lint at the start of blocks

Expand Down
Loading

0 comments on commit 2f90b2a

Please sign in to comment.