mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 07:04:18 +00:00
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 changelog: none
This commit is contained in:
parent
f8ba19287d
commit
eb3970285b
181 changed files with 1035 additions and 998 deletions
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
#[warn(clippy::cognitive_complexity)]
|
||||
|
|
|
@ -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() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
#[allow(unused_assignments)]
|
||||
#[warn(clippy::misrefactored_assign_op, clippy::assign_op_pattern)]
|
||||
fn main() {
|
||||
|
|
|
@ -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;
|
||||
| ^^^^^^^^^^
|
||||
|
@ -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;
|
||||
| ^^^^^^^^^^
|
||||
|
@ -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;
|
||||
| ^^^^^^^^^^
|
||||
|
@ -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;
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -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;
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -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;
|
||||
| ^^^^^^^^^^
|
||||
|
@ -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;
|
||||
| ^^^^^^^^^^
|
||||
|
@ -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;
|
||||
| ^^^^^^^^^^
|
||||
|
@ -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;
|
||||
| ^^^^^^^^^^
|
||||
|
@ -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()`
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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`
|
||||
|
@ -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`
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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`
|
||||
|
@ -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)`
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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!");
|
||||
|
@ -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)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -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 | | }
|
||||
|
@ -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`: '{}'",
|
||||
|
@ -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 | | }
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 | | };
|
||||
|
@ -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 | | }
|
||||
|
@ -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; }
|
||||
| ^^^^^^^^^^^
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
error: all if blocks contain the same code at the start
|
||||
--> $DIR/shared_at_top.rs:10:5
|
||||
--> $DIR/shared_at_top.rs:11:5
|
||||
|
|
||||
LL | / if true {
|
||||
LL | | println!("Hello World!");
|
||||
| |_________________________________^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/shared_at_top.rs:2:36
|
||||
--> $DIR/shared_at_top.rs:1:9
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: consider moving these statements before the if
|
||||
|
|
||||
LL ~ println!("Hello World!");
|
||||
|
@ -17,7 +17,7 @@ LL + if true {
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at the start
|
||||
--> $DIR/shared_at_top.rs:19:5
|
||||
--> $DIR/shared_at_top.rs:20:5
|
||||
|
|
||||
LL | / if x == 0 {
|
||||
LL | | let y = 9;
|
||||
|
@ -35,7 +35,7 @@ LL + if x == 0 {
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at the start
|
||||
--> $DIR/shared_at_top.rs:40:5
|
||||
--> $DIR/shared_at_top.rs:41:5
|
||||
|
|
||||
LL | / let _ = if x == 7 {
|
||||
LL | | let y = 16;
|
||||
|
@ -48,7 +48,7 @@ LL + let _ = if x == 7 {
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at the start
|
||||
--> $DIR/shared_at_top.rs:58:5
|
||||
--> $DIR/shared_at_top.rs:59:5
|
||||
|
|
||||
LL | / if x == 10 {
|
||||
LL | | let used_value_name = "Different type";
|
||||
|
@ -64,7 +64,7 @@ LL + if x == 10 {
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at the start
|
||||
--> $DIR/shared_at_top.rs:72:5
|
||||
--> $DIR/shared_at_top.rs:73:5
|
||||
|
|
||||
LL | / if x == 11 {
|
||||
LL | | let can_be_overridden = "Move me";
|
||||
|
@ -80,7 +80,7 @@ LL + if x == 11 {
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at the start
|
||||
--> $DIR/shared_at_top.rs:88:5
|
||||
--> $DIR/shared_at_top.rs:89:5
|
||||
|
|
||||
LL | / if x == 2020 {
|
||||
LL | | println!("This should trigger the `SHARED_CODE_IN_IF_BLOCKS` lint.");
|
||||
|
@ -95,7 +95,7 @@ LL + if x == 2020 {
|
|||
|
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/shared_at_top.rs:96:18
|
||||
--> $DIR/shared_at_top.rs:97:18
|
||||
|
|
||||
LL | if x == 2019 {
|
||||
| __________________^
|
||||
|
@ -104,12 +104,12 @@ LL | | } else {
|
|||
| |_____^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/shared_at_top.rs:2:9
|
||||
--> $DIR/shared_at_top.rs:1:40
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: same as this
|
||||
--> $DIR/shared_at_top.rs:98:12
|
||||
--> $DIR/shared_at_top.rs:99:12
|
||||
|
|
||||
LL | } else {
|
||||
| ____________^
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
|
||||
#![allow(dead_code)]
|
||||
#![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
// branches_sharing_code at the top and bottom of the if blocks
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: all if blocks contain the same code at both the start and the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:16:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:17:5
|
||||
|
|
||||
LL | / if x == 7 {
|
||||
LL | | let t = 7;
|
||||
|
@ -8,12 +8,12 @@ LL | | let _overlap_end = 2 * t;
|
|||
| |_________________________________^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/shared_at_top_and_bottom.rs:2:36
|
||||
--> $DIR/shared_at_top_and_bottom.rs:1:9
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: this code is shared at the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:28:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:29:5
|
||||
|
|
||||
LL | / let _u = 9;
|
||||
LL | | }
|
||||
|
@ -32,7 +32,7 @@ LL + let _u = 9;
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at both the start and the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:32:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:33:5
|
||||
|
|
||||
LL | / if x == 99 {
|
||||
LL | | let r = 7;
|
||||
|
@ -41,7 +41,7 @@ LL | | let _overlap_middle = r * r;
|
|||
| |____________________________________^
|
||||
|
|
||||
note: this code is shared at the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:43:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:44:5
|
||||
|
|
||||
LL | / let _overlap_end = r * r * r;
|
||||
LL | | let z = "end";
|
||||
|
@ -63,7 +63,7 @@ LL + let z = "end";
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at both the start and the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:61:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:62:5
|
||||
|
|
||||
LL | / if (x > 7 && y < 13) || (x + y) % 2 == 1 {
|
||||
LL | | let a = 0xcafe;
|
||||
|
@ -72,7 +72,7 @@ LL | | let e_id = gen_id(a, b);
|
|||
| |________________________________^
|
||||
|
|
||||
note: this code is shared at the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:81:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:82:5
|
||||
|
|
||||
LL | / let pack = DataPack {
|
||||
LL | | id: e_id,
|
||||
|
@ -102,14 +102,14 @@ LL + process_data(pack);
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at both the start and the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:94:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:95:5
|
||||
|
|
||||
LL | / let _ = if x == 7 {
|
||||
LL | | let _ = 19;
|
||||
| |___________________^
|
||||
|
|
||||
note: this code is shared at the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:103:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:104:5
|
||||
|
|
||||
LL | / x << 2
|
||||
LL | | };
|
||||
|
@ -127,14 +127,14 @@ LL ~ x << 2;
|
|||
|
|
||||
|
||||
error: all if blocks contain the same code at both the start and the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:106:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:107:5
|
||||
|
|
||||
LL | / if x == 9 {
|
||||
LL | | let _ = 17;
|
||||
| |___________________^
|
||||
|
|
||||
note: this code is shared at the end
|
||||
--> $DIR/shared_at_top_and_bottom.rs:115:5
|
||||
--> $DIR/shared_at_top_and_bottom.rs:116:5
|
||||
|
|
||||
LL | / x * 4
|
||||
LL | | }
|
||||
|
|
|
@ -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 valid if blocks that shouldn't trigger the lint
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this `if` has identical blocks
|
||||
--> $DIR/valid_if_blocks.rs:104:14
|
||||
--> $DIR/valid_if_blocks.rs:105:14
|
||||
|
|
||||
LL | if false {
|
||||
| ______________^
|
||||
|
@ -7,12 +7,12 @@ LL | | } else {
|
|||
| |_____^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/valid_if_blocks.rs:2:9
|
||||
--> $DIR/valid_if_blocks.rs:1:40
|
||||
|
|
||||
LL | #![deny(clippy::if_same_then_else, clippy::branches_sharing_code)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | #![deny(clippy::branches_sharing_code, clippy::if_same_then_else)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: same as this
|
||||
--> $DIR/valid_if_blocks.rs:105:12
|
||||
--> $DIR/valid_if_blocks.rs:106:12
|
||||
|
|
||||
LL | } else {
|
||||
| ____________^
|
||||
|
@ -20,7 +20,7 @@ LL | | }
|
|||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/valid_if_blocks.rs:115:15
|
||||
--> $DIR/valid_if_blocks.rs:116:15
|
||||
|
|
||||
LL | if x == 0 {
|
||||
| _______________^
|
||||
|
@ -31,7 +31,7 @@ LL | | } else {
|
|||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/valid_if_blocks.rs:119:12
|
||||
--> $DIR/valid_if_blocks.rs:120:12
|
||||
|
|
||||
LL | } else {
|
||||
| ____________^
|
||||
|
@ -42,19 +42,19 @@ LL | | }
|
|||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/valid_if_blocks.rs:126:23
|
||||
--> $DIR/valid_if_blocks.rs:127:23
|
||||
|
|
||||
LL | let _ = if x == 6 { 7 } else { 7 };
|
||||
| ^^^^^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/valid_if_blocks.rs:126:34
|
||||
--> $DIR/valid_if_blocks.rs:127:34
|
||||
|
|
||||
LL | let _ = if x == 6 { 7 } else { 7 };
|
||||
| ^^^^^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/valid_if_blocks.rs:132:23
|
||||
--> $DIR/valid_if_blocks.rs:133:23
|
||||
|
|
||||
LL | } else if x == 68 {
|
||||
| _______________________^
|
||||
|
@ -66,7 +66,7 @@ LL | | } else {
|
|||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/valid_if_blocks.rs:137:12
|
||||
--> $DIR/valid_if_blocks.rs:138:12
|
||||
|
|
||||
LL | } else {
|
||||
| ____________^
|
||||
|
@ -78,7 +78,7 @@ LL | | };
|
|||
| |_____^
|
||||
|
||||
error: this `if` has identical blocks
|
||||
--> $DIR/valid_if_blocks.rs:146:23
|
||||
--> $DIR/valid_if_blocks.rs:147:23
|
||||
|
|
||||
LL | } else if x == 68 {
|
||||
| _______________________^
|
||||
|
@ -88,7 +88,7 @@ LL | | } else {
|
|||
| |_____^
|
||||
|
|
||||
note: same as this
|
||||
--> $DIR/valid_if_blocks.rs:149:12
|
||||
--> $DIR/valid_if_blocks.rs:150:12
|
||||
|
|
||||
LL | } else {
|
||||
| ____________^
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// run-rustfix
|
||||
#![warn(clippy::cast_abs_to_unsigned)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn main() {
|
||||
let x: i32 = -42;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// run-rustfix
|
||||
#![warn(clippy::cast_abs_to_unsigned)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn main() {
|
||||
let x: i32 = -42;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: casting the result of `i32::abs()` to u32
|
||||
--> $DIR/cast_abs_to_unsigned.rs:6:18
|
||||
--> $DIR/cast_abs_to_unsigned.rs:7:18
|
||||
|
|
||||
LL | let y: u32 = x.abs() as u32;
|
||||
| ^^^^^^^^^^^^^^ help: replace with: `x.unsigned_abs()`
|
||||
|
@ -7,97 +7,97 @@ LL | let y: u32 = x.abs() as u32;
|
|||
= note: `-D clippy::cast-abs-to-unsigned` implied by `-D warnings`
|
||||
|
||||
error: casting the result of `i32::abs()` to usize
|
||||
--> $DIR/cast_abs_to_unsigned.rs:10:20
|
||||
--> $DIR/cast_abs_to_unsigned.rs:11:20
|
||||
|
|
||||
LL | let _: usize = a.abs() as usize;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i32::abs()` to usize
|
||||
--> $DIR/cast_abs_to_unsigned.rs:11:20
|
||||
--> $DIR/cast_abs_to_unsigned.rs:12:20
|
||||
|
|
||||
LL | let _: usize = a.abs() as _;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i32::abs()` to usize
|
||||
--> $DIR/cast_abs_to_unsigned.rs:12:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:13:13
|
||||
|
|
||||
LL | let _ = a.abs() as usize;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i64::abs()` to usize
|
||||
--> $DIR/cast_abs_to_unsigned.rs:15:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:16:13
|
||||
|
|
||||
LL | let _ = a.abs() as usize;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i64::abs()` to u8
|
||||
--> $DIR/cast_abs_to_unsigned.rs:16:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:17:13
|
||||
|
|
||||
LL | let _ = a.abs() as u8;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i64::abs()` to u16
|
||||
--> $DIR/cast_abs_to_unsigned.rs:17:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:18:13
|
||||
|
|
||||
LL | let _ = a.abs() as u16;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i64::abs()` to u32
|
||||
--> $DIR/cast_abs_to_unsigned.rs:18:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:19:13
|
||||
|
|
||||
LL | let _ = a.abs() as u32;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i64::abs()` to u64
|
||||
--> $DIR/cast_abs_to_unsigned.rs:19:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:20:13
|
||||
|
|
||||
LL | let _ = a.abs() as u64;
|
||||
| ^^^^^^^^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i64::abs()` to u128
|
||||
--> $DIR/cast_abs_to_unsigned.rs:20:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:21:13
|
||||
|
|
||||
LL | let _ = a.abs() as u128;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `isize::abs()` to usize
|
||||
--> $DIR/cast_abs_to_unsigned.rs:23:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:24:13
|
||||
|
|
||||
LL | let _ = a.abs() as usize;
|
||||
| ^^^^^^^^^^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `isize::abs()` to u8
|
||||
--> $DIR/cast_abs_to_unsigned.rs:24:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:25:13
|
||||
|
|
||||
LL | let _ = a.abs() as u8;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `isize::abs()` to u16
|
||||
--> $DIR/cast_abs_to_unsigned.rs:25:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:26:13
|
||||
|
|
||||
LL | let _ = a.abs() as u16;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `isize::abs()` to u32
|
||||
--> $DIR/cast_abs_to_unsigned.rs:26:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:27:13
|
||||
|
|
||||
LL | let _ = a.abs() as u32;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `isize::abs()` to u64
|
||||
--> $DIR/cast_abs_to_unsigned.rs:27:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:28:13
|
||||
|
|
||||
LL | let _ = a.abs() as u64;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `isize::abs()` to u128
|
||||
--> $DIR/cast_abs_to_unsigned.rs:28:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:29:13
|
||||
|
|
||||
LL | let _ = a.abs() as u128;
|
||||
| ^^^^^^^ help: replace with: `a.unsigned_abs()`
|
||||
|
||||
error: casting the result of `i64::abs()` to u32
|
||||
--> $DIR/cast_abs_to_unsigned.rs:30:13
|
||||
--> $DIR/cast_abs_to_unsigned.rs:31:13
|
||||
|
|
||||
LL | let _ = (x as i64 - y as i64).abs() as u32;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `(x as i64 - y as i64).unsigned_abs()`
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#![warn(clippy::collapsible_match)]
|
||||
#![allow(
|
||||
clippy::equatable_if_let,
|
||||
clippy::needless_return,
|
||||
clippy::no_effect,
|
||||
clippy::single_match,
|
||||
clippy::equatable_if_let
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
fn lint_cases(opt_opt: Option<Option<u32>>, res_opt: Result<Option<u32>, String>) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this `match` can be collapsed into the outer `match`
|
||||
--> $DIR/collapsible_match.rs:12:20
|
||||
--> $DIR/collapsible_match.rs:13:20
|
||||
|
|
||||
LL | Ok(val) => match val {
|
||||
| ____________________^
|
||||
|
@ -10,7 +10,7 @@ LL | | },
|
|||
|
|
||||
= note: `-D clippy::collapsible-match` implied by `-D warnings`
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:12:12
|
||||
--> $DIR/collapsible_match.rs:13:12
|
||||
|
|
||||
LL | Ok(val) => match val {
|
||||
| ^^^ replace this binding
|
||||
|
@ -18,7 +18,7 @@ LL | Some(n) => foo(n),
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `match` can be collapsed into the outer `match`
|
||||
--> $DIR/collapsible_match.rs:21:20
|
||||
--> $DIR/collapsible_match.rs:22:20
|
||||
|
|
||||
LL | Ok(val) => match val {
|
||||
| ____________________^
|
||||
|
@ -28,7 +28,7 @@ LL | | },
|
|||
| |_________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:21:12
|
||||
--> $DIR/collapsible_match.rs:22:12
|
||||
|
|
||||
LL | Ok(val) => match val {
|
||||
| ^^^ replace this binding
|
||||
|
@ -36,7 +36,7 @@ LL | Some(n) => foo(n),
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `if let` can be collapsed into the outer `if let`
|
||||
--> $DIR/collapsible_match.rs:30:9
|
||||
--> $DIR/collapsible_match.rs:31:9
|
||||
|
|
||||
LL | / if let Some(n) = val {
|
||||
LL | | take(n);
|
||||
|
@ -44,7 +44,7 @@ LL | | }
|
|||
| |_________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:29:15
|
||||
--> $DIR/collapsible_match.rs:30:15
|
||||
|
|
||||
LL | if let Ok(val) = res_opt {
|
||||
| ^^^ replace this binding
|
||||
|
@ -52,7 +52,7 @@ LL | if let Some(n) = val {
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `if let` can be collapsed into the outer `if let`
|
||||
--> $DIR/collapsible_match.rs:37:9
|
||||
--> $DIR/collapsible_match.rs:38:9
|
||||
|
|
||||
LL | / if let Some(n) = val {
|
||||
LL | | take(n);
|
||||
|
@ -62,7 +62,7 @@ LL | | }
|
|||
| |_________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:36:15
|
||||
--> $DIR/collapsible_match.rs:37:15
|
||||
|
|
||||
LL | if let Ok(val) = res_opt {
|
||||
| ^^^ replace this binding
|
||||
|
@ -70,7 +70,7 @@ LL | if let Some(n) = val {
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `match` can be collapsed into the outer `if let`
|
||||
--> $DIR/collapsible_match.rs:48:9
|
||||
--> $DIR/collapsible_match.rs:49:9
|
||||
|
|
||||
LL | / match val {
|
||||
LL | | Some(n) => foo(n),
|
||||
|
@ -79,7 +79,7 @@ LL | | }
|
|||
| |_________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:47:15
|
||||
--> $DIR/collapsible_match.rs:48:15
|
||||
|
|
||||
LL | if let Ok(val) = res_opt {
|
||||
| ^^^ replace this binding
|
||||
|
@ -88,7 +88,7 @@ LL | Some(n) => foo(n),
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `if let` can be collapsed into the outer `match`
|
||||
--> $DIR/collapsible_match.rs:57:13
|
||||
--> $DIR/collapsible_match.rs:58:13
|
||||
|
|
||||
LL | / if let Some(n) = val {
|
||||
LL | | take(n);
|
||||
|
@ -96,7 +96,7 @@ LL | | }
|
|||
| |_____________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:56:12
|
||||
--> $DIR/collapsible_match.rs:57:12
|
||||
|
|
||||
LL | Ok(val) => {
|
||||
| ^^^ replace this binding
|
||||
|
@ -104,7 +104,7 @@ LL | if let Some(n) = val {
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `match` can be collapsed into the outer `if let`
|
||||
--> $DIR/collapsible_match.rs:66:9
|
||||
--> $DIR/collapsible_match.rs:67:9
|
||||
|
|
||||
LL | / match val {
|
||||
LL | | Some(n) => foo(n),
|
||||
|
@ -113,7 +113,7 @@ LL | | }
|
|||
| |_________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:65:15
|
||||
--> $DIR/collapsible_match.rs:66:15
|
||||
|
|
||||
LL | if let Ok(val) = res_opt {
|
||||
| ^^^ replace this binding
|
||||
|
@ -122,7 +122,7 @@ LL | Some(n) => foo(n),
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `if let` can be collapsed into the outer `match`
|
||||
--> $DIR/collapsible_match.rs:77:13
|
||||
--> $DIR/collapsible_match.rs:78:13
|
||||
|
|
||||
LL | / if let Some(n) = val {
|
||||
LL | | take(n);
|
||||
|
@ -132,7 +132,7 @@ LL | | }
|
|||
| |_____________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:76:12
|
||||
--> $DIR/collapsible_match.rs:77:12
|
||||
|
|
||||
LL | Ok(val) => {
|
||||
| ^^^ replace this binding
|
||||
|
@ -140,7 +140,7 @@ LL | if let Some(n) = val {
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `match` can be collapsed into the outer `match`
|
||||
--> $DIR/collapsible_match.rs:88:20
|
||||
--> $DIR/collapsible_match.rs:89:20
|
||||
|
|
||||
LL | Ok(val) => match val {
|
||||
| ____________________^
|
||||
|
@ -150,7 +150,7 @@ LL | | },
|
|||
| |_________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:88:12
|
||||
--> $DIR/collapsible_match.rs:89:12
|
||||
|
|
||||
LL | Ok(val) => match val {
|
||||
| ^^^ replace this binding
|
||||
|
@ -158,7 +158,7 @@ LL | Some(n) => foo(n),
|
|||
| ^^^^^^^ with this pattern
|
||||
|
||||
error: this `match` can be collapsed into the outer `match`
|
||||
--> $DIR/collapsible_match.rs:97:22
|
||||
--> $DIR/collapsible_match.rs:98:22
|
||||
|
|
||||
LL | Some(val) => match val {
|
||||
| ______________________^
|
||||
|
@ -168,7 +168,7 @@ LL | | },
|
|||
| |_________^
|
||||
|
|
||||
help: the outer pattern can be modified to include the inner pattern
|
||||
--> $DIR/collapsible_match.rs:97:14
|
||||
--> $DIR/collapsible_match.rs:98:14
|
||||
|
|
||||
LL | Some(val) => match val {
|
||||
| ^^^ replace this binding
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
pub struct ArrayWrapper<const N: usize>([usize; N]);
|
||||
|
||||
impl<const N: usize> ArrayWrapper<{ N }> {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(clippy::disallowed_names)]
|
||||
#![allow(clippy::disallowed_names, clippy::uninlined_format_args)]
|
||||
|
||||
pub fn foo(bar: *const u8) {
|
||||
println!("{:#p}", bar);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// run-rustfix
|
||||
// aux-build: proc_macro_with_span.rs
|
||||
|
||||
#![allow(unused_imports, dead_code)]
|
||||
#![deny(clippy::default_trait_access)]
|
||||
#![allow(dead_code, unused_imports)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
extern crate proc_macro_with_span;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// run-rustfix
|
||||
// aux-build: proc_macro_with_span.rs
|
||||
|
||||
#![allow(unused_imports, dead_code)]
|
||||
#![deny(clippy::default_trait_access)]
|
||||
#![allow(dead_code, unused_imports)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
extern crate proc_macro_with_span;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | let s1: String = Default::default();
|
|||
| ^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/default_trait_access.rs:5:9
|
||||
--> $DIR/default_trait_access.rs:3:9
|
||||
|
|
||||
LL | #![deny(clippy::default_trait_access)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::no_effect,
|
||||
clippy::redundant_closure_call,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::needless_borrow
|
||||
)]
|
||||
#![warn(clippy::redundant_closure, clippy::redundant_closure_for_method_calls)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::no_effect,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::redundant_closure_call,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::no_effect,
|
||||
clippy::redundant_closure_call,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::needless_borrow
|
||||
)]
|
||||
#![warn(clippy::redundant_closure, clippy::redundant_closure_for_method_calls)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::no_effect,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::redundant_closure_call,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::expect_fun_call)]
|
||||
#![allow(clippy::to_string_in_format_args)]
|
||||
#![allow(clippy::to_string_in_format_args, clippy::uninlined_format_args)]
|
||||
|
||||
/// Checks implementation of the `EXPECT_FUN_CALL` lint
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::expect_fun_call)]
|
||||
#![allow(clippy::to_string_in_format_args)]
|
||||
#![allow(clippy::to_string_in_format_args, clippy::uninlined_format_args)]
|
||||
|
||||
/// Checks implementation of the `EXPECT_FUN_CALL` lint
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:35:26
|
||||
--> $DIR/expect_fun_call.rs:34:26
|
||||
|
|
||||
LL | with_none_and_format.expect(&format!("Error {}: fake error", error_code));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
|
||||
|
@ -7,73 +7,73 @@ LL | with_none_and_format.expect(&format!("Error {}: fake error", error_code
|
|||
= note: `-D clippy::expect-fun-call` implied by `-D warnings`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:38:26
|
||||
--> $DIR/expect_fun_call.rs:37:26
|
||||
|
|
||||
LL | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:41:37
|
||||
--> $DIR/expect_fun_call.rs:40:37
|
||||
|
|
||||
LL | with_none_and_format_with_macro.expect(format!("Error {}: fake error", one!()).as_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", one!()))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:51:25
|
||||
--> $DIR/expect_fun_call.rs:50:25
|
||||
|
|
||||
LL | with_err_and_format.expect(&format!("Error {}: fake error", error_code));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:54:25
|
||||
--> $DIR/expect_fun_call.rs:53:25
|
||||
|
|
||||
LL | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:66:17
|
||||
--> $DIR/expect_fun_call.rs:65:17
|
||||
|
|
||||
LL | Some("foo").expect(format!("{} {}", 1, 2).as_ref());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{} {}", 1, 2))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:87:21
|
||||
--> $DIR/expect_fun_call.rs:86:21
|
||||
|
|
||||
LL | Some("foo").expect(&get_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_string()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:88:21
|
||||
--> $DIR/expect_fun_call.rs:87:21
|
||||
|
|
||||
LL | Some("foo").expect(get_string().as_ref());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_string()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:89:21
|
||||
--> $DIR/expect_fun_call.rs:88:21
|
||||
|
|
||||
LL | Some("foo").expect(get_string().as_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_string()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:91:21
|
||||
--> $DIR/expect_fun_call.rs:90:21
|
||||
|
|
||||
LL | Some("foo").expect(get_static_str());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_static_str()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:92:21
|
||||
--> $DIR/expect_fun_call.rs:91:21
|
||||
|
|
||||
LL | Some("foo").expect(get_non_static_str(&0));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_non_static_str(&0).to_string()) })`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:96:16
|
||||
--> $DIR/expect_fun_call.rs:95:16
|
||||
|
|
||||
LL | Some(true).expect(&format!("key {}, {}", 1, 2));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("key {}, {}", 1, 2))`
|
||||
|
||||
error: use of `expect` followed by a function call
|
||||
--> $DIR/expect_fun_call.rs:102:17
|
||||
--> $DIR/expect_fun_call.rs:101:17
|
||||
|
|
||||
LL | opt_ref.expect(&format!("{:?}", opt_ref));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{:?}", opt_ref))`
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::explicit_counter_loop)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn main() {
|
||||
let mut vec = vec![1, 2, 3, 4];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: the variable `_index` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:6:5
|
||||
--> $DIR/explicit_counter_loop.rs:7:5
|
||||
|
|
||||
LL | for _v in &vec {
|
||||
| ^^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.iter().enumerate()`
|
||||
|
@ -7,49 +7,49 @@ LL | for _v in &vec {
|
|||
= note: `-D clippy::explicit-counter-loop` implied by `-D warnings`
|
||||
|
||||
error: the variable `_index` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:12:5
|
||||
--> $DIR/explicit_counter_loop.rs:13:5
|
||||
|
|
||||
LL | for _v in &vec {
|
||||
| ^^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.iter().enumerate()`
|
||||
|
||||
error: the variable `_index` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:17:5
|
||||
--> $DIR/explicit_counter_loop.rs:18:5
|
||||
|
|
||||
LL | for _v in &mut vec {
|
||||
| ^^^^^^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.iter_mut().enumerate()`
|
||||
|
||||
error: the variable `_index` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:22:5
|
||||
--> $DIR/explicit_counter_loop.rs:23:5
|
||||
|
|
||||
LL | for _v in vec {
|
||||
| ^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.into_iter().enumerate()`
|
||||
|
||||
error: the variable `count` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:61:9
|
||||
--> $DIR/explicit_counter_loop.rs:62:9
|
||||
|
|
||||
LL | for ch in text.chars() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (count, ch) in text.chars().enumerate()`
|
||||
|
||||
error: the variable `count` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:72:9
|
||||
--> $DIR/explicit_counter_loop.rs:73:9
|
||||
|
|
||||
LL | for ch in text.chars() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (count, ch) in text.chars().enumerate()`
|
||||
|
||||
error: the variable `count` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:130:9
|
||||
--> $DIR/explicit_counter_loop.rs:131:9
|
||||
|
|
||||
LL | for _i in 3..10 {
|
||||
| ^^^^^^^^^^^^^^^ help: consider using: `for (count, _i) in (3..10).enumerate()`
|
||||
|
||||
error: the variable `idx_usize` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:170:9
|
||||
--> $DIR/explicit_counter_loop.rs:171:9
|
||||
|
|
||||
LL | for _item in slice {
|
||||
| ^^^^^^^^^^^^^^^^^^ help: consider using: `for (idx_usize, _item) in slice.iter().enumerate()`
|
||||
|
||||
error: the variable `idx_u32` is used as a loop counter
|
||||
--> $DIR/explicit_counter_loop.rs:182:9
|
||||
--> $DIR/explicit_counter_loop.rs:183:9
|
||||
|
|
||||
LL | for _item in slice {
|
||||
| ^^^^^^^^^^^^^^^^^^ help: consider using: `for (idx_u32, _item) in (0_u32..).zip(slice.iter())`
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(
|
||||
unused_variables,
|
||||
clippy::clone_double_ref,
|
||||
clippy::needless_borrow,
|
||||
clippy::borrow_deref_ref,
|
||||
clippy::explicit_auto_deref
|
||||
)]
|
||||
#![warn(clippy::explicit_deref_methods)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(
|
||||
clippy::borrow_deref_ref,
|
||||
clippy::clone_double_ref,
|
||||
clippy::explicit_auto_deref,
|
||||
clippy::needless_borrow,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(
|
||||
unused_variables,
|
||||
clippy::clone_double_ref,
|
||||
clippy::needless_borrow,
|
||||
clippy::borrow_deref_ref,
|
||||
clippy::explicit_auto_deref
|
||||
)]
|
||||
#![warn(clippy::explicit_deref_methods)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(
|
||||
clippy::borrow_deref_ref,
|
||||
clippy::clone_double_ref,
|
||||
clippy::explicit_auto_deref,
|
||||
clippy::needless_borrow,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-rustfix
|
||||
#![allow(unused_imports)]
|
||||
#![warn(clippy::explicit_write)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn stdout() -> String {
|
||||
String::new()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-rustfix
|
||||
#![allow(unused_imports)]
|
||||
#![warn(clippy::explicit_write)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn stdout() -> String {
|
||||
String::new()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: use of `write!(stdout(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:23:9
|
||||
--> $DIR/explicit_write.rs:24:9
|
||||
|
|
||||
LL | write!(std::io::stdout(), "test").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `print!("test")`
|
||||
|
@ -7,73 +7,73 @@ LL | write!(std::io::stdout(), "test").unwrap();
|
|||
= note: `-D clippy::explicit-write` implied by `-D warnings`
|
||||
|
||||
error: use of `write!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:24:9
|
||||
--> $DIR/explicit_write.rs:25:9
|
||||
|
|
||||
LL | write!(std::io::stderr(), "test").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprint!("test")`
|
||||
|
||||
error: use of `writeln!(stdout(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:25:9
|
||||
--> $DIR/explicit_write.rs:26:9
|
||||
|
|
||||
LL | writeln!(std::io::stdout(), "test").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `println!("test")`
|
||||
|
||||
error: use of `writeln!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:26:9
|
||||
--> $DIR/explicit_write.rs:27:9
|
||||
|
|
||||
LL | writeln!(std::io::stderr(), "test").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("test")`
|
||||
|
||||
error: use of `stdout().write_fmt(...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:27:9
|
||||
--> $DIR/explicit_write.rs:28:9
|
||||
|
|
||||
LL | std::io::stdout().write_fmt(format_args!("test")).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `print!("test")`
|
||||
|
||||
error: use of `stderr().write_fmt(...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:28:9
|
||||
--> $DIR/explicit_write.rs:29:9
|
||||
|
|
||||
LL | std::io::stderr().write_fmt(format_args!("test")).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprint!("test")`
|
||||
|
||||
error: use of `writeln!(stdout(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:31:9
|
||||
--> $DIR/explicit_write.rs:32:9
|
||||
|
|
||||
LL | writeln!(std::io::stdout(), "test/ntest").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `println!("test/ntest")`
|
||||
|
||||
error: use of `writeln!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:32:9
|
||||
--> $DIR/explicit_write.rs:33:9
|
||||
|
|
||||
LL | writeln!(std::io::stderr(), "test/ntest").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("test/ntest")`
|
||||
|
||||
error: use of `writeln!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:35:9
|
||||
--> $DIR/explicit_write.rs:36:9
|
||||
|
|
||||
LL | writeln!(std::io::stderr(), "with {}", value).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("with {}", value)`
|
||||
|
||||
error: use of `writeln!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:36:9
|
||||
--> $DIR/explicit_write.rs:37:9
|
||||
|
|
||||
LL | writeln!(std::io::stderr(), "with {} {}", 2, value).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("with {} {}", 2, value)`
|
||||
|
||||
error: use of `writeln!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:37:9
|
||||
--> $DIR/explicit_write.rs:38:9
|
||||
|
|
||||
LL | writeln!(std::io::stderr(), "with {value}").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("with {value}")`
|
||||
|
||||
error: use of `writeln!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:38:9
|
||||
--> $DIR/explicit_write.rs:39:9
|
||||
|
|
||||
LL | writeln!(std::io::stderr(), "macro arg {}", one!()).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("macro arg {}", one!())`
|
||||
|
||||
error: use of `writeln!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write.rs:40:9
|
||||
--> $DIR/explicit_write.rs:41:9
|
||||
|
|
||||
LL | writeln!(std::io::stderr(), "{:w$}", value, w = width).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `eprintln!("{:w$}", value, w = width)`
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![deny(clippy::fallible_impl_from)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
// docs example
|
||||
struct Foo(i32);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: consider implementing `TryFrom` instead
|
||||
--> $DIR/fallible_impl_from.rs:5:1
|
||||
--> $DIR/fallible_impl_from.rs:6:1
|
||||
|
|
||||
LL | / impl From<String> for Foo {
|
||||
LL | | fn from(s: String) -> Self {
|
||||
|
@ -15,13 +15,13 @@ LL | #![deny(clippy::fallible_impl_from)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
|
||||
note: potential failure(s)
|
||||
--> $DIR/fallible_impl_from.rs:7:13
|
||||
--> $DIR/fallible_impl_from.rs:8:13
|
||||
|
|
||||
LL | Foo(s.parse().unwrap())
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: consider implementing `TryFrom` instead
|
||||
--> $DIR/fallible_impl_from.rs:26:1
|
||||
--> $DIR/fallible_impl_from.rs:27:1
|
||||
|
|
||||
LL | / impl From<usize> for Invalid {
|
||||
LL | | fn from(i: usize) -> Invalid {
|
||||
|
@ -34,14 +34,14 @@ LL | | }
|
|||
|
|
||||
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
|
||||
note: potential failure(s)
|
||||
--> $DIR/fallible_impl_from.rs:29:13
|
||||
--> $DIR/fallible_impl_from.rs:30:13
|
||||
|
|
||||
LL | panic!();
|
||||
| ^^^^^^^^
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: consider implementing `TryFrom` instead
|
||||
--> $DIR/fallible_impl_from.rs:35:1
|
||||
--> $DIR/fallible_impl_from.rs:36:1
|
||||
|
|
||||
LL | / impl From<Option<String>> for Invalid {
|
||||
LL | | fn from(s: Option<String>) -> Invalid {
|
||||
|
@ -54,7 +54,7 @@ LL | | }
|
|||
|
|
||||
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
|
||||
note: potential failure(s)
|
||||
--> $DIR/fallible_impl_from.rs:37:17
|
||||
--> $DIR/fallible_impl_from.rs:38:17
|
||||
|
|
||||
LL | let s = s.unwrap();
|
||||
| ^^^^^^^^^^
|
||||
|
@ -68,7 +68,7 @@ LL | panic!("{:?}", s);
|
|||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: consider implementing `TryFrom` instead
|
||||
--> $DIR/fallible_impl_from.rs:53:1
|
||||
--> $DIR/fallible_impl_from.rs:54:1
|
||||
|
|
||||
LL | / impl<'a> From<&'a mut <Box<u32> as ProjStrTrait>::ProjString> for Invalid {
|
||||
LL | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid {
|
||||
|
@ -81,7 +81,7 @@ LL | | }
|
|||
|
|
||||
= help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
|
||||
note: potential failure(s)
|
||||
--> $DIR/fallible_impl_from.rs:55:12
|
||||
--> $DIR/fallible_impl_from.rs:56:12
|
||||
|
|
||||
LL | if s.parse::<u32>().ok().unwrap() != 42 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(dead_code, unused)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::collections::*;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(dead_code, unused)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::collections::*;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::for_loops_over_fallibles)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn for_loops_over_fallibles() {
|
||||
let option = Some(1);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:9:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:10:14
|
||||
|
|
||||
LL | for x in option {
|
||||
| ^^^^^^
|
||||
|
@ -8,7 +8,7 @@ LL | for x in option {
|
|||
= help: consider replacing `for x in option` with `if let Some(x) = option`
|
||||
|
||||
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:14:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:15:14
|
||||
|
|
||||
LL | for x in option.iter() {
|
||||
| ^^^^^^
|
||||
|
@ -16,7 +16,7 @@ LL | for x in option.iter() {
|
|||
= help: consider replacing `for x in option.iter()` with `if let Some(x) = option`
|
||||
|
||||
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:19:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:20:14
|
||||
|
|
||||
LL | for x in result {
|
||||
| ^^^^^^
|
||||
|
@ -24,7 +24,7 @@ LL | for x in result {
|
|||
= help: consider replacing `for x in result` with `if let Ok(x) = result`
|
||||
|
||||
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:24:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:25:14
|
||||
|
|
||||
LL | for x in result.iter_mut() {
|
||||
| ^^^^^^
|
||||
|
@ -32,7 +32,7 @@ LL | for x in result.iter_mut() {
|
|||
= help: consider replacing `for x in result.iter_mut()` with `if let Ok(x) = result`
|
||||
|
||||
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:29:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:30:14
|
||||
|
|
||||
LL | for x in result.into_iter() {
|
||||
| ^^^^^^
|
||||
|
@ -40,7 +40,7 @@ LL | for x in result.into_iter() {
|
|||
= help: consider replacing `for x in result.into_iter()` with `if let Ok(x) = result`
|
||||
|
||||
error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:33:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:34:14
|
||||
|
|
||||
LL | for x in option.ok_or("x not found") {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -48,7 +48,7 @@ LL | for x in option.ok_or("x not found") {
|
|||
= help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
|
||||
|
||||
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
||||
--> $DIR/for_loops_over_fallibles.rs:39:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:40:14
|
||||
|
|
||||
LL | for x in v.iter().next() {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
@ -56,7 +56,7 @@ LL | for x in v.iter().next() {
|
|||
= note: `#[deny(clippy::iter_next_loop)]` on by default
|
||||
|
||||
error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:44:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:45:14
|
||||
|
|
||||
LL | for x in v.iter().next().and(Some(0)) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -64,7 +64,7 @@ LL | for x in v.iter().next().and(Some(0)) {
|
|||
= help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
|
||||
|
||||
error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
|
||||
--> $DIR/for_loops_over_fallibles.rs:48:14
|
||||
--> $DIR/for_loops_over_fallibles.rs:49:14
|
||||
|
|
||||
LL | for x in v.iter().next().ok_or("x not found") {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -72,7 +72,7 @@ LL | for x in v.iter().next().ok_or("x not found") {
|
|||
= help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")`
|
||||
|
||||
error: this loop never actually loops
|
||||
--> $DIR/for_loops_over_fallibles.rs:60:5
|
||||
--> $DIR/for_loops_over_fallibles.rs:61:5
|
||||
|
|
||||
LL | / while let Some(x) = option {
|
||||
LL | | println!("{}", x);
|
||||
|
@ -83,7 +83,7 @@ LL | | }
|
|||
= note: `#[deny(clippy::never_loop)]` on by default
|
||||
|
||||
error: this loop never actually loops
|
||||
--> $DIR/for_loops_over_fallibles.rs:66:5
|
||||
--> $DIR/for_loops_over_fallibles.rs:67:5
|
||||
|
|
||||
LL | / while let Ok(x) = result {
|
||||
LL | | println!("{}", x);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::useless_format)]
|
||||
#![allow(
|
||||
unused_tuple_struct_fields,
|
||||
clippy::print_literal,
|
||||
clippy::redundant_clone,
|
||||
clippy::to_string_in_format_args,
|
||||
clippy::needless_borrow
|
||||
clippy::needless_borrow,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
#![warn(clippy::useless_format)]
|
||||
|
||||
struct Foo(pub String);
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::useless_format)]
|
||||
#![allow(
|
||||
unused_tuple_struct_fields,
|
||||
clippy::print_literal,
|
||||
clippy::redundant_clone,
|
||||
clippy::to_string_in_format_args,
|
||||
clippy::needless_borrow
|
||||
clippy::needless_borrow,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
#![warn(clippy::useless_format)]
|
||||
|
||||
struct Foo(pub String);
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(unused)]
|
||||
#![allow(clippy::assertions_on_constants)]
|
||||
#![allow(clippy::eq_op)]
|
||||
#![allow(clippy::print_literal)]
|
||||
#![warn(clippy::to_string_in_format_args)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
clippy::assertions_on_constants,
|
||||
clippy::eq_op,
|
||||
clippy::print_literal,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::io::{stdout, Write};
|
||||
use std::ops::Deref;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(unused)]
|
||||
#![allow(clippy::assertions_on_constants)]
|
||||
#![allow(clippy::eq_op)]
|
||||
#![allow(clippy::print_literal)]
|
||||
#![warn(clippy::to_string_in_format_args)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
clippy::assertions_on_constants,
|
||||
clippy::eq_op,
|
||||
clippy::print_literal,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::io::{stdout, Write};
|
||||
use std::ops::Deref;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: `to_string` applied to a type that implements `Display` in `format!` args
|
||||
--> $DIR/format_args.rs:74:72
|
||||
--> $DIR/format_args.rs:76:72
|
||||
|
|
||||
LL | let _ = format!("error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
@ -7,133 +7,133 @@ LL | let _ = format!("error: something failed at {}", Location::caller().to_
|
|||
= note: `-D clippy::to-string-in-format-args` implied by `-D warnings`
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `write!` args
|
||||
--> $DIR/format_args.rs:78:27
|
||||
--> $DIR/format_args.rs:80:27
|
||||
|
|
||||
LL | Location::caller().to_string()
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `writeln!` args
|
||||
--> $DIR/format_args.rs:83:27
|
||||
--> $DIR/format_args.rs:85:27
|
||||
|
|
||||
LL | Location::caller().to_string()
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `print!` args
|
||||
--> $DIR/format_args.rs:85:63
|
||||
--> $DIR/format_args.rs:87:63
|
||||
|
|
||||
LL | print!("error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:86:65
|
||||
--> $DIR/format_args.rs:88:65
|
||||
|
|
||||
LL | println!("error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `eprint!` args
|
||||
--> $DIR/format_args.rs:87:64
|
||||
--> $DIR/format_args.rs:89:64
|
||||
|
|
||||
LL | eprint!("error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `eprintln!` args
|
||||
--> $DIR/format_args.rs:88:66
|
||||
--> $DIR/format_args.rs:90:66
|
||||
|
|
||||
LL | eprintln!("error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `format_args!` args
|
||||
--> $DIR/format_args.rs:89:77
|
||||
--> $DIR/format_args.rs:91:77
|
||||
|
|
||||
LL | let _ = format_args!("error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `assert!` args
|
||||
--> $DIR/format_args.rs:90:70
|
||||
--> $DIR/format_args.rs:92:70
|
||||
|
|
||||
LL | assert!(true, "error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `assert_eq!` args
|
||||
--> $DIR/format_args.rs:91:73
|
||||
--> $DIR/format_args.rs:93:73
|
||||
|
|
||||
LL | assert_eq!(0, 0, "error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `assert_ne!` args
|
||||
--> $DIR/format_args.rs:92:73
|
||||
--> $DIR/format_args.rs:94:73
|
||||
|
|
||||
LL | assert_ne!(0, 0, "error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `panic!` args
|
||||
--> $DIR/format_args.rs:93:63
|
||||
--> $DIR/format_args.rs:95:63
|
||||
|
|
||||
LL | panic!("error: something failed at {}", Location::caller().to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:94:20
|
||||
--> $DIR/format_args.rs:96:20
|
||||
|
|
||||
LL | println!("{}", X(1).to_string());
|
||||
| ^^^^^^^^^^^^^^^^ help: use this: `*X(1)`
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:95:20
|
||||
--> $DIR/format_args.rs:97:20
|
||||
|
|
||||
LL | println!("{}", Y(&X(1)).to_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: use this: `***Y(&X(1))`
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:96:24
|
||||
--> $DIR/format_args.rs:98:24
|
||||
|
|
||||
LL | println!("{}", Z(1).to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:97:20
|
||||
--> $DIR/format_args.rs:99:20
|
||||
|
|
||||
LL | println!("{}", x.to_string());
|
||||
| ^^^^^^^^^^^^^ help: use this: `**x`
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:98:20
|
||||
--> $DIR/format_args.rs:100:20
|
||||
|
|
||||
LL | println!("{}", x_ref.to_string());
|
||||
| ^^^^^^^^^^^^^^^^^ help: use this: `***x_ref`
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:100:39
|
||||
--> $DIR/format_args.rs:102:39
|
||||
|
|
||||
LL | println!("{foo}{bar}", foo = "foo".to_string(), bar = "bar");
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:101:52
|
||||
--> $DIR/format_args.rs:103:52
|
||||
|
|
||||
LL | println!("{foo}{bar}", foo = "foo", bar = "bar".to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:102:39
|
||||
--> $DIR/format_args.rs:104:39
|
||||
|
|
||||
LL | println!("{foo}{bar}", bar = "bar".to_string(), foo = "foo");
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:103:52
|
||||
--> $DIR/format_args.rs:105:52
|
||||
|
|
||||
LL | println!("{foo}{bar}", bar = "bar", foo = "foo".to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `format!` args
|
||||
--> $DIR/format_args.rs:142:38
|
||||
--> $DIR/format_args.rs:144:38
|
||||
|
|
||||
LL | let x = format!("{} {}", a, b.to_string());
|
||||
| ^^^^^^^^^^^^ help: remove this
|
||||
|
||||
error: `to_string` applied to a type that implements `Display` in `println!` args
|
||||
--> $DIR/format_args.rs:156:24
|
||||
--> $DIR/format_args.rs:158:24
|
||||
|
|
||||
LL | println!("{}", original[..10].to_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use this: `&original[..10]`
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#![allow(clippy::assertions_on_constants)]
|
||||
#![allow(clippy::eq_op)]
|
||||
#![warn(clippy::format_in_format_args)]
|
||||
#![warn(clippy::to_string_in_format_args)]
|
||||
#![warn(clippy::format_in_format_args, clippy::to_string_in_format_args)]
|
||||
#![allow(clippy::assertions_on_constants, clippy::eq_op, clippy::uninlined_format_args)]
|
||||
|
||||
use std::io::{stdout, Error, ErrorKind, Write};
|
||||
use std::ops::Deref;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: `format!` in `println!` args
|
||||
--> $DIR/format_args_unfixable.rs:27:5
|
||||
--> $DIR/format_args_unfixable.rs:25:5
|
||||
|
|
||||
LL | println!("error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -9,7 +9,7 @@ LL | println!("error: {}", format!("something failed at {}", Location::calle
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `println!` args
|
||||
--> $DIR/format_args_unfixable.rs:28:5
|
||||
--> $DIR/format_args_unfixable.rs:26:5
|
||||
|
|
||||
LL | println!("{}: {}", error, format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -18,7 +18,7 @@ LL | println!("{}: {}", error, format!("something failed at {}", Location::c
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `println!` args
|
||||
--> $DIR/format_args_unfixable.rs:29:5
|
||||
--> $DIR/format_args_unfixable.rs:27:5
|
||||
|
|
||||
LL | println!("{:?}: {}", error, format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -27,7 +27,7 @@ LL | println!("{:?}: {}", error, format!("something failed at {}", Location:
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `println!` args
|
||||
--> $DIR/format_args_unfixable.rs:30:5
|
||||
--> $DIR/format_args_unfixable.rs:28:5
|
||||
|
|
||||
LL | println!("{{}}: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -36,7 +36,7 @@ LL | println!("{{}}: {}", format!("something failed at {}", Location::caller
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `println!` args
|
||||
--> $DIR/format_args_unfixable.rs:31:5
|
||||
--> $DIR/format_args_unfixable.rs:29:5
|
||||
|
|
||||
LL | println!(r#"error: "{}""#, format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -45,7 +45,7 @@ LL | println!(r#"error: "{}""#, format!("something failed at {}", Location::
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `println!` args
|
||||
--> $DIR/format_args_unfixable.rs:32:5
|
||||
--> $DIR/format_args_unfixable.rs:30:5
|
||||
|
|
||||
LL | println!("error: {}", format!(r#"something failed at "{}""#, Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -54,7 +54,7 @@ LL | println!("error: {}", format!(r#"something failed at "{}""#, Location::
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `println!` args
|
||||
--> $DIR/format_args_unfixable.rs:33:5
|
||||
--> $DIR/format_args_unfixable.rs:31:5
|
||||
|
|
||||
LL | println!("error: {}", format!("something failed at {} {0}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -63,7 +63,7 @@ LL | println!("error: {}", format!("something failed at {} {0}", Location::c
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `format!` args
|
||||
--> $DIR/format_args_unfixable.rs:34:13
|
||||
--> $DIR/format_args_unfixable.rs:32:13
|
||||
|
|
||||
LL | let _ = format!("error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -72,7 +72,7 @@ LL | let _ = format!("error: {}", format!("something failed at {}", Location
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `write!` args
|
||||
--> $DIR/format_args_unfixable.rs:35:13
|
||||
--> $DIR/format_args_unfixable.rs:33:13
|
||||
|
|
||||
LL | let _ = write!(
|
||||
| _____________^
|
||||
|
@ -86,7 +86,7 @@ LL | | );
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `writeln!` args
|
||||
--> $DIR/format_args_unfixable.rs:40:13
|
||||
--> $DIR/format_args_unfixable.rs:38:13
|
||||
|
|
||||
LL | let _ = writeln!(
|
||||
| _____________^
|
||||
|
@ -100,7 +100,7 @@ LL | | );
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `print!` args
|
||||
--> $DIR/format_args_unfixable.rs:45:5
|
||||
--> $DIR/format_args_unfixable.rs:43:5
|
||||
|
|
||||
LL | print!("error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -109,7 +109,7 @@ LL | print!("error: {}", format!("something failed at {}", Location::caller(
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `eprint!` args
|
||||
--> $DIR/format_args_unfixable.rs:46:5
|
||||
--> $DIR/format_args_unfixable.rs:44:5
|
||||
|
|
||||
LL | eprint!("error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -118,7 +118,7 @@ LL | eprint!("error: {}", format!("something failed at {}", Location::caller
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `eprintln!` args
|
||||
--> $DIR/format_args_unfixable.rs:47:5
|
||||
--> $DIR/format_args_unfixable.rs:45:5
|
||||
|
|
||||
LL | eprintln!("error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -127,7 +127,7 @@ LL | eprintln!("error: {}", format!("something failed at {}", Location::call
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `format_args!` args
|
||||
--> $DIR/format_args_unfixable.rs:48:13
|
||||
--> $DIR/format_args_unfixable.rs:46:13
|
||||
|
|
||||
LL | let _ = format_args!("error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -136,7 +136,7 @@ LL | let _ = format_args!("error: {}", format!("something failed at {}", Loc
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `assert!` args
|
||||
--> $DIR/format_args_unfixable.rs:49:5
|
||||
--> $DIR/format_args_unfixable.rs:47:5
|
||||
|
|
||||
LL | assert!(true, "error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -145,7 +145,7 @@ LL | assert!(true, "error: {}", format!("something failed at {}", Location::
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `assert_eq!` args
|
||||
--> $DIR/format_args_unfixable.rs:50:5
|
||||
--> $DIR/format_args_unfixable.rs:48:5
|
||||
|
|
||||
LL | assert_eq!(0, 0, "error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -154,7 +154,7 @@ LL | assert_eq!(0, 0, "error: {}", format!("something failed at {}", Locatio
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `assert_ne!` args
|
||||
--> $DIR/format_args_unfixable.rs:51:5
|
||||
--> $DIR/format_args_unfixable.rs:49:5
|
||||
|
|
||||
LL | assert_ne!(0, 0, "error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -163,7 +163,7 @@ LL | assert_ne!(0, 0, "error: {}", format!("something failed at {}", Locatio
|
|||
= help: or consider changing `format!` to `format_args!`
|
||||
|
||||
error: `format!` in `panic!` args
|
||||
--> $DIR/format_args_unfixable.rs:52:5
|
||||
--> $DIR/format_args_unfixable.rs:50:5
|
||||
|
|
||||
LL | panic!("error: {}", format!("something failed at {}", Location::caller()));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![warn(clippy::all)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(unused_unsafe, clippy::missing_safety_doc)]
|
||||
#![allow(dead_code, unused_unsafe)]
|
||||
#![allow(clippy::missing_safety_doc, clippy::uninlined_format_args)]
|
||||
|
||||
// TOO_MANY_ARGUMENTS
|
||||
fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::identity_op)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
clippy::eq_op,
|
||||
clippy::no_effect,
|
||||
clippy::unnecessary_operation,
|
||||
clippy::op_ref,
|
||||
clippy::double_parens,
|
||||
unused
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::fmt::Write as _;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::identity_op)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
clippy::eq_op,
|
||||
clippy::no_effect,
|
||||
clippy::unnecessary_operation,
|
||||
clippy::op_ref,
|
||||
clippy::double_parens,
|
||||
unused
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::fmt::Write as _;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![deny(clippy::index_refutable_slice)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
enum SomeEnum<T> {
|
||||
One(T),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:13:17
|
||||
--> $DIR/if_let_slice_binding.rs:14:17
|
||||
|
|
||||
LL | if let Some(slice) = slice {
|
||||
| ^^^^^
|
||||
|
@ -19,7 +19,7 @@ LL | println!("{}", slice_0);
|
|||
| ~~~~~~~
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:19:17
|
||||
--> $DIR/if_let_slice_binding.rs:20:17
|
||||
|
|
||||
LL | if let Some(slice) = slice {
|
||||
| ^^^^^
|
||||
|
@ -34,7 +34,7 @@ LL | println!("{}", slice_0);
|
|||
| ~~~~~~~
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:25:17
|
||||
--> $DIR/if_let_slice_binding.rs:26:17
|
||||
|
|
||||
LL | if let Some(slice) = slice {
|
||||
| ^^^^^
|
||||
|
@ -50,7 +50,7 @@ LL ~ println!("{}", slice_0);
|
|||
|
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:32:26
|
||||
--> $DIR/if_let_slice_binding.rs:33:26
|
||||
|
|
||||
LL | if let SomeEnum::One(slice) | SomeEnum::Three(slice) = slice_wrapped {
|
||||
| ^^^^^
|
||||
|
@ -65,7 +65,7 @@ LL | println!("{}", slice_0);
|
|||
| ~~~~~~~
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:39:29
|
||||
--> $DIR/if_let_slice_binding.rs:40:29
|
||||
|
|
||||
LL | if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
|
||||
| ^
|
||||
|
@ -80,7 +80,7 @@ LL | println!("{} -> {}", a_2, b[1]);
|
|||
| ~~~
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:39:38
|
||||
--> $DIR/if_let_slice_binding.rs:40:38
|
||||
|
|
||||
LL | if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
|
||||
| ^
|
||||
|
@ -95,7 +95,7 @@ LL | println!("{} -> {}", a[2], b_1);
|
|||
| ~~~
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:46:21
|
||||
--> $DIR/if_let_slice_binding.rs:47:21
|
||||
|
|
||||
LL | if let Some(ref slice) = slice {
|
||||
| ^^^^^
|
||||
|
@ -110,7 +110,7 @@ LL | println!("{:?}", slice_1);
|
|||
| ~~~~~~~
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:54:17
|
||||
--> $DIR/if_let_slice_binding.rs:55:17
|
||||
|
|
||||
LL | if let Some(slice) = &slice {
|
||||
| ^^^^^
|
||||
|
@ -125,7 +125,7 @@ LL | println!("{:?}", slice_0);
|
|||
| ~~~~~~~
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:123:17
|
||||
--> $DIR/if_let_slice_binding.rs:124:17
|
||||
|
|
||||
LL | if let Some(slice) = wrap.inner {
|
||||
| ^^^^^
|
||||
|
@ -140,7 +140,7 @@ LL | println!("This is awesome! {}", slice_0);
|
|||
| ~~~~~~~
|
||||
|
||||
error: this binding can be a slice pattern to avoid indexing
|
||||
--> $DIR/if_let_slice_binding.rs:130:17
|
||||
--> $DIR/if_let_slice_binding.rs:131:17
|
||||
|
|
||||
LL | if let Some(slice) = wrap.inner {
|
||||
| ^^^^^
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::iter::repeat;
|
||||
fn square_is_lower_64(x: &u32) -> bool {
|
||||
x * x < 64
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
error: infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:9:5
|
||||
--> $DIR/infinite_iter.rs:11:5
|
||||
|
|
||||
LL | repeat(0_u8).collect::<Vec<_>>(); // infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/infinite_iter.rs:7:8
|
||||
--> $DIR/infinite_iter.rs:9:8
|
||||
|
|
||||
LL | #[deny(clippy::infinite_iter)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:10:5
|
||||
--> $DIR/infinite_iter.rs:12:5
|
||||
|
|
||||
LL | (0..8_u32).take_while(square_is_lower_64).cycle().count(); // infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:11:5
|
||||
--> $DIR/infinite_iter.rs:13:5
|
||||
|
|
||||
LL | (0..8_u64).chain(0..).max(); // infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:16:5
|
||||
--> $DIR/infinite_iter.rs:18:5
|
||||
|
|
||||
LL | / (0..8_u32)
|
||||
LL | | .rev()
|
||||
|
@ -33,37 +33,37 @@ LL | | .for_each(|x| println!("{}", x)); // infinite iter
|
|||
| |________________________________________^
|
||||
|
||||
error: infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:22:5
|
||||
--> $DIR/infinite_iter.rs:24:5
|
||||
|
|
||||
LL | (0_usize..).flat_map(|x| 0..x).product::<usize>(); // infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:23:5
|
||||
--> $DIR/infinite_iter.rs:25:5
|
||||
|
|
||||
LL | (0_u64..).filter(|x| x % 2 == 0).last(); // infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: possible infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:30:5
|
||||
--> $DIR/infinite_iter.rs:32:5
|
||||
|
|
||||
LL | (0..).zip((0..).take_while(square_is_lower_64)).count(); // maybe infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/infinite_iter.rs:28:8
|
||||
--> $DIR/infinite_iter.rs:30:8
|
||||
|
|
||||
LL | #[deny(clippy::maybe_infinite_iter)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: possible infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:31:5
|
||||
--> $DIR/infinite_iter.rs:33:5
|
||||
|
|
||||
LL | repeat(42).take_while(|x| *x == 42).chain(0..42).max(); // maybe infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: possible infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:32:5
|
||||
--> $DIR/infinite_iter.rs:34:5
|
||||
|
|
||||
LL | / (1..)
|
||||
LL | | .scan(0, |state, x| {
|
||||
|
@ -74,31 +74,31 @@ LL | | .min(); // maybe infinite iter
|
|||
| |______________^
|
||||
|
||||
error: possible infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:38:5
|
||||
--> $DIR/infinite_iter.rs:40:5
|
||||
|
|
||||
LL | (0..).find(|x| *x == 24); // maybe infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: possible infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:39:5
|
||||
--> $DIR/infinite_iter.rs:41:5
|
||||
|
|
||||
LL | (0..).position(|x| x == 24); // maybe infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: possible infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:40:5
|
||||
--> $DIR/infinite_iter.rs:42:5
|
||||
|
|
||||
LL | (0..).any(|x| x == 24); // maybe infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: possible infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:41:5
|
||||
--> $DIR/infinite_iter.rs:43:5
|
||||
|
|
||||
LL | (0..).all(|x| x == 24); // maybe infinite iter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: infinite iteration detected
|
||||
--> $DIR/infinite_iter.rs:63:31
|
||||
--> $DIR/infinite_iter.rs:65:31
|
||||
|
|
||||
LL | let _: HashSet<i32> = (0..).collect(); // Infinite iter
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-rustfix
|
||||
#![deny(clippy::while_let_on_iterator)]
|
||||
#![allow(unused_mut)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::iter::Iterator;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-rustfix
|
||||
#![deny(clippy::while_let_on_iterator)]
|
||||
#![allow(unused_mut)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::iter::Iterator;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this loop could be written as a `for` loop
|
||||
--> $DIR/issue_2356.rs:17:9
|
||||
--> $DIR/issue_2356.rs:18:9
|
||||
|
|
||||
LL | while let Some(e) = it.next() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for e in it`
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![allow(dead_code)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
async fn sink1<'a>(_: &'a str) {} // lint
|
||||
async fn sink1_elided(_: &str) {} // ok
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/issue_4266.rs:3:1
|
||||
--> $DIR/issue_4266.rs:4:1
|
||||
|
|
||||
LL | async fn sink1<'a>(_: &'a str) {} // lint
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -7,13 +7,13 @@ LL | async fn sink1<'a>(_: &'a str) {} // lint
|
|||
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`
|
||||
|
||||
error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
|
||||
--> $DIR/issue_4266.rs:7:1
|
||||
--> $DIR/issue_4266.rs:8:1
|
||||
|
|
||||
LL | async fn one_to_one<'a>(s: &'a str) -> &'a str {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: methods called `new` usually take no `self`
|
||||
--> $DIR/issue_4266.rs:27:22
|
||||
--> $DIR/issue_4266.rs:28:22
|
||||
|
|
||||
LL | pub async fn new(&mut self) -> Self {
|
||||
| ^^^^^^^^^
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::items_after_statements)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn ok() {
|
||||
fn foo() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: adding items after statements is confusing, since items exist from the start of the scope
|
||||
--> $DIR/item_after_statement.rs:12:5
|
||||
--> $DIR/item_after_statement.rs:13:5
|
||||
|
|
||||
LL | / fn foo() {
|
||||
LL | | println!("foo");
|
||||
|
@ -9,7 +9,7 @@ LL | | }
|
|||
= note: `-D clippy::items-after-statements` implied by `-D warnings`
|
||||
|
||||
error: adding items after statements is confusing, since items exist from the start of the scope
|
||||
--> $DIR/item_after_statement.rs:19:5
|
||||
--> $DIR/item_after_statement.rs:20:5
|
||||
|
|
||||
LL | / fn foo() {
|
||||
LL | | println!("foo");
|
||||
|
@ -17,7 +17,7 @@ LL | | }
|
|||
| |_____^
|
||||
|
||||
error: adding items after statements is confusing, since items exist from the start of the scope
|
||||
--> $DIR/item_after_statement.rs:32:13
|
||||
--> $DIR/item_after_statement.rs:33:13
|
||||
|
|
||||
LL | / fn say_something() {
|
||||
LL | | println!("something");
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::manual_assert)]
|
||||
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]
|
||||
#![allow(dead_code, unused_doc_comments)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args)]
|
||||
|
||||
macro_rules! one {
|
||||
() => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:30:5
|
||||
--> $DIR/manual_assert.rs:31:5
|
||||
|
|
||||
LL | / if !a.is_empty() {
|
||||
LL | | panic!("qaqaq{:?}", a);
|
||||
|
@ -13,7 +13,7 @@ LL | assert!(a.is_empty(), "qaqaq{:?}", a);
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:33:5
|
||||
--> $DIR/manual_assert.rs:34:5
|
||||
|
|
||||
LL | / if !a.is_empty() {
|
||||
LL | | panic!("qwqwq");
|
||||
|
@ -26,7 +26,7 @@ LL | assert!(a.is_empty(), "qwqwq");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:50:5
|
||||
--> $DIR/manual_assert.rs:51:5
|
||||
|
|
||||
LL | / if b.is_empty() {
|
||||
LL | | panic!("panic1");
|
||||
|
@ -39,7 +39,7 @@ LL | assert!(!b.is_empty(), "panic1");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:53:5
|
||||
--> $DIR/manual_assert.rs:54:5
|
||||
|
|
||||
LL | / if b.is_empty() && a.is_empty() {
|
||||
LL | | panic!("panic2");
|
||||
|
@ -52,7 +52,7 @@ LL | assert!(!(b.is_empty() && a.is_empty()), "panic2");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:56:5
|
||||
--> $DIR/manual_assert.rs:57:5
|
||||
|
|
||||
LL | / if a.is_empty() && !b.is_empty() {
|
||||
LL | | panic!("panic3");
|
||||
|
@ -65,7 +65,7 @@ LL | assert!(!(a.is_empty() && !b.is_empty()), "panic3");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:59:5
|
||||
--> $DIR/manual_assert.rs:60:5
|
||||
|
|
||||
LL | / if b.is_empty() || a.is_empty() {
|
||||
LL | | panic!("panic4");
|
||||
|
@ -78,7 +78,7 @@ LL | assert!(!(b.is_empty() || a.is_empty()), "panic4");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:62:5
|
||||
--> $DIR/manual_assert.rs:63:5
|
||||
|
|
||||
LL | / if a.is_empty() || !b.is_empty() {
|
||||
LL | | panic!("panic5");
|
||||
|
@ -91,7 +91,7 @@ LL | assert!(!(a.is_empty() || !b.is_empty()), "panic5");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:65:5
|
||||
--> $DIR/manual_assert.rs:66:5
|
||||
|
|
||||
LL | / if a.is_empty() {
|
||||
LL | | panic!("with expansion {}", one!())
|
||||
|
@ -104,7 +104,7 @@ LL | assert!(!a.is_empty(), "with expansion {}", one!());
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:72:5
|
||||
--> $DIR/manual_assert.rs:73:5
|
||||
|
|
||||
LL | / if a > 2 {
|
||||
LL | | // comment
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::manual_assert)]
|
||||
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]
|
||||
#![allow(dead_code, unused_doc_comments)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args)]
|
||||
|
||||
macro_rules! one {
|
||||
() => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:30:5
|
||||
--> $DIR/manual_assert.rs:31:5
|
||||
|
|
||||
LL | / if !a.is_empty() {
|
||||
LL | | panic!("qaqaq{:?}", a);
|
||||
|
@ -13,7 +13,7 @@ LL | assert!(a.is_empty(), "qaqaq{:?}", a);
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:33:5
|
||||
--> $DIR/manual_assert.rs:34:5
|
||||
|
|
||||
LL | / if !a.is_empty() {
|
||||
LL | | panic!("qwqwq");
|
||||
|
@ -26,7 +26,7 @@ LL | assert!(a.is_empty(), "qwqwq");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:50:5
|
||||
--> $DIR/manual_assert.rs:51:5
|
||||
|
|
||||
LL | / if b.is_empty() {
|
||||
LL | | panic!("panic1");
|
||||
|
@ -39,7 +39,7 @@ LL | assert!(!b.is_empty(), "panic1");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:53:5
|
||||
--> $DIR/manual_assert.rs:54:5
|
||||
|
|
||||
LL | / if b.is_empty() && a.is_empty() {
|
||||
LL | | panic!("panic2");
|
||||
|
@ -52,7 +52,7 @@ LL | assert!(!(b.is_empty() && a.is_empty()), "panic2");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:56:5
|
||||
--> $DIR/manual_assert.rs:57:5
|
||||
|
|
||||
LL | / if a.is_empty() && !b.is_empty() {
|
||||
LL | | panic!("panic3");
|
||||
|
@ -65,7 +65,7 @@ LL | assert!(!(a.is_empty() && !b.is_empty()), "panic3");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:59:5
|
||||
--> $DIR/manual_assert.rs:60:5
|
||||
|
|
||||
LL | / if b.is_empty() || a.is_empty() {
|
||||
LL | | panic!("panic4");
|
||||
|
@ -78,7 +78,7 @@ LL | assert!(!(b.is_empty() || a.is_empty()), "panic4");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:62:5
|
||||
--> $DIR/manual_assert.rs:63:5
|
||||
|
|
||||
LL | / if a.is_empty() || !b.is_empty() {
|
||||
LL | | panic!("panic5");
|
||||
|
@ -91,7 +91,7 @@ LL | assert!(!(a.is_empty() || !b.is_empty()), "panic5");
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:65:5
|
||||
--> $DIR/manual_assert.rs:66:5
|
||||
|
|
||||
LL | / if a.is_empty() {
|
||||
LL | | panic!("with expansion {}", one!())
|
||||
|
@ -104,7 +104,7 @@ LL | assert!(!a.is_empty(), "with expansion {}", one!());
|
|||
|
|
||||
|
||||
error: only a `panic!` in `if`-then statement
|
||||
--> $DIR/manual_assert.rs:72:5
|
||||
--> $DIR/manual_assert.rs:73:5
|
||||
|
|
||||
LL | / if a > 2 {
|
||||
LL | | // comment
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::manual_assert)]
|
||||
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]
|
||||
#![allow(dead_code, unused_doc_comments)]
|
||||
#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args)]
|
||||
|
||||
macro_rules! one {
|
||||
() => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(unused, clippy::needless_return)]
|
||||
#![warn(clippy::manual_find)]
|
||||
#![allow(unused)]
|
||||
#![allow(clippy::needless_return, clippy::uninlined_format_args)]
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![allow(unused, clippy::needless_return)]
|
||||
#![warn(clippy::manual_find)]
|
||||
#![allow(unused)]
|
||||
#![allow(clippy::needless_return, clippy::uninlined_format_args)]
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![warn(clippy::manual_flatten)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
#![allow(clippy::useless_vec, clippy::uninlined_format_args)]
|
||||
|
||||
fn main() {
|
||||
// Test for loop over implicitly adjusted `Iterator` with `if let` expression
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// aux-build:option_helpers.rs
|
||||
|
||||
#![warn(clippy::map_unwrap_or)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate option_helpers;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-rustfix
|
||||
#![warn(clippy::match_ref_pats)]
|
||||
#![allow(dead_code, unused_variables, clippy::equatable_if_let, clippy::enum_variant_names)]
|
||||
#![allow(dead_code, unused_variables)]
|
||||
#![allow(clippy::enum_variant_names, clippy::equatable_if_let, clippy::uninlined_format_args)]
|
||||
|
||||
fn ref_pats() {
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// run-rustfix
|
||||
#![warn(clippy::match_ref_pats)]
|
||||
#![allow(dead_code, unused_variables, clippy::equatable_if_let, clippy::enum_variant_names)]
|
||||
#![allow(dead_code, unused_variables)]
|
||||
#![allow(clippy::enum_variant_names, clippy::equatable_if_let, clippy::uninlined_format_args)]
|
||||
|
||||
fn ref_pats() {
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: you don't need to add `&` to all patterns
|
||||
--> $DIR/match_ref_pats.rs:8:9
|
||||
--> $DIR/match_ref_pats.rs:9:9
|
||||
|
|
||||
LL | / match v {
|
||||
LL | | &Some(v) => println!("{:?}", v),
|
||||
|
@ -16,7 +16,7 @@ LL ~ None => println!("none"),
|
|||
|
|
||||
|
||||
error: you don't need to add `&` to both the expression and the patterns
|
||||
--> $DIR/match_ref_pats.rs:25:5
|
||||
--> $DIR/match_ref_pats.rs:26:5
|
||||
|
|
||||
LL | / match &w {
|
||||
LL | | &Some(v) => println!("{:?}", v),
|
||||
|
@ -32,7 +32,7 @@ LL ~ None => println!("none"),
|
|||
|
|
||||
|
||||
error: redundant pattern matching, consider using `is_none()`
|
||||
--> $DIR/match_ref_pats.rs:37:12
|
||||
--> $DIR/match_ref_pats.rs:38:12
|
||||
|
|
||||
LL | if let &None = a {
|
||||
| -------^^^^^---- help: try this: `if a.is_none()`
|
||||
|
@ -40,13 +40,13 @@ LL | if let &None = a {
|
|||
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
|
||||
|
||||
error: redundant pattern matching, consider using `is_none()`
|
||||
--> $DIR/match_ref_pats.rs:42:12
|
||||
--> $DIR/match_ref_pats.rs:43:12
|
||||
|
|
||||
LL | if let &None = &b {
|
||||
| -------^^^^^----- help: try this: `if b.is_none()`
|
||||
|
||||
error: you don't need to add `&` to all patterns
|
||||
--> $DIR/match_ref_pats.rs:102:9
|
||||
--> $DIR/match_ref_pats.rs:103:9
|
||||
|
|
||||
LL | / match foobar_variant!(0) {
|
||||
LL | | &FooBar::Foo => println!("Foo"),
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::match_result_ok)]
|
||||
#![allow(clippy::boxed_local)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(clippy::boxed_local, clippy::uninlined_format_args)]
|
||||
|
||||
// Checking `if` cases
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::match_result_ok)]
|
||||
#![allow(clippy::boxed_local)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(clippy::boxed_local, clippy::uninlined_format_args)]
|
||||
|
||||
// Checking `if` cases
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: matching on `Some` with `ok()` is redundant
|
||||
--> $DIR/match_result_ok.rs:10:5
|
||||
--> $DIR/match_result_ok.rs:9:5
|
||||
|
|
||||
LL | if let Some(y) = x.parse().ok() { y } else { 0 }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -11,7 +11,7 @@ LL | if let Ok(y) = x.parse() { y } else { 0 }
|
|||
| ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: matching on `Some` with `ok()` is redundant
|
||||
--> $DIR/match_result_ok.rs:20:9
|
||||
--> $DIR/match_result_ok.rs:19:9
|
||||
|
|
||||
LL | if let Some(y) = x . parse() . ok () {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -22,7 +22,7 @@ LL | if let Ok(y) = x . parse() {
|
|||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: matching on `Some` with `ok()` is redundant
|
||||
--> $DIR/match_result_ok.rs:46:5
|
||||
--> $DIR/match_result_ok.rs:45:5
|
||||
|
|
||||
LL | while let Some(a) = wat.next().ok() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#![warn(clippy::match_same_arms)]
|
||||
#![allow(clippy::disallowed_names, clippy::diverging_sub_expression)]
|
||||
#![allow(
|
||||
clippy::disallowed_names,
|
||||
clippy::diverging_sub_expression,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
fn bar<T>(_: T) {}
|
||||
fn foo() -> bool {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this match arm has an identical body to the `_` wildcard arm
|
||||
--> $DIR/match_same_arms2.rs:11:9
|
||||
--> $DIR/match_same_arms2.rs:15:9
|
||||
|
|
||||
LL | / 42 => {
|
||||
LL | | foo();
|
||||
|
@ -13,7 +13,7 @@ LL | | },
|
|||
= note: `-D clippy::match-same-arms` implied by `-D warnings`
|
||||
= help: or try changing either arm body
|
||||
note: `_` wildcard arm here
|
||||
--> $DIR/match_same_arms2.rs:20:9
|
||||
--> $DIR/match_same_arms2.rs:24:9
|
||||
|
|
||||
LL | / _ => {
|
||||
LL | | //~ ERROR match arms have same body
|
||||
|
@ -25,7 +25,7 @@ LL | | },
|
|||
| |_________^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:34:9
|
||||
--> $DIR/match_same_arms2.rs:38:9
|
||||
|
|
||||
LL | 51 => foo(), //~ ERROR match arms have same body
|
||||
| --^^^^^^^^^
|
||||
|
@ -34,13 +34,13 @@ LL | 51 => foo(), //~ ERROR match arms have same body
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:33:9
|
||||
--> $DIR/match_same_arms2.rs:37:9
|
||||
|
|
||||
LL | 42 => foo(),
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:40:9
|
||||
--> $DIR/match_same_arms2.rs:44:9
|
||||
|
|
||||
LL | None => 24, //~ ERROR match arms have same body
|
||||
| ----^^^^^^
|
||||
|
@ -49,13 +49,13 @@ LL | None => 24, //~ ERROR match arms have same body
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:39:9
|
||||
--> $DIR/match_same_arms2.rs:43:9
|
||||
|
|
||||
LL | Some(_) => 24,
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:62:9
|
||||
--> $DIR/match_same_arms2.rs:66:9
|
||||
|
|
||||
LL | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
|
||||
| ---------------^^^^^^^^^^
|
||||
|
@ -64,13 +64,13 @@ LL | (None, Some(a)) => bar(a), //~ ERROR match arms have same body
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:61:9
|
||||
--> $DIR/match_same_arms2.rs:65:9
|
||||
|
|
||||
LL | (Some(a), None) => bar(a),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:67:9
|
||||
--> $DIR/match_same_arms2.rs:71:9
|
||||
|
|
||||
LL | (Some(a), ..) => bar(a),
|
||||
| -------------^^^^^^^^^^
|
||||
|
@ -79,13 +79,13 @@ LL | (Some(a), ..) => bar(a),
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:68:9
|
||||
--> $DIR/match_same_arms2.rs:72:9
|
||||
|
|
||||
LL | (.., Some(a)) => bar(a), //~ ERROR match arms have same body
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:101:9
|
||||
--> $DIR/match_same_arms2.rs:105:9
|
||||
|
|
||||
LL | (Ok(x), Some(_)) => println!("ok {}", x),
|
||||
| ----------------^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -94,13 +94,13 @@ LL | (Ok(x), Some(_)) => println!("ok {}", x),
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:102:9
|
||||
--> $DIR/match_same_arms2.rs:106:9
|
||||
|
|
||||
LL | (Ok(_), Some(x)) => println!("ok {}", x),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:117:9
|
||||
--> $DIR/match_same_arms2.rs:121:9
|
||||
|
|
||||
LL | Ok(_) => println!("ok"),
|
||||
| -----^^^^^^^^^^^^^^^^^^
|
||||
|
@ -109,13 +109,13 @@ LL | Ok(_) => println!("ok"),
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:116:9
|
||||
--> $DIR/match_same_arms2.rs:120:9
|
||||
|
|
||||
LL | Ok(3) => println!("ok"),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:144:9
|
||||
--> $DIR/match_same_arms2.rs:148:9
|
||||
|
|
||||
LL | 1 => {
|
||||
| ^ help: try merging the arm patterns: `1 | 0`
|
||||
|
@ -127,7 +127,7 @@ LL | | },
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:141:9
|
||||
--> $DIR/match_same_arms2.rs:145:9
|
||||
|
|
||||
LL | / 0 => {
|
||||
LL | | empty!(0);
|
||||
|
@ -135,7 +135,7 @@ LL | | },
|
|||
| |_________^
|
||||
|
||||
error: match expression looks like `matches!` macro
|
||||
--> $DIR/match_same_arms2.rs:162:16
|
||||
--> $DIR/match_same_arms2.rs:166:16
|
||||
|
|
||||
LL | let _ans = match x {
|
||||
| ________________^
|
||||
|
@ -148,7 +148,7 @@ LL | | };
|
|||
= note: `-D clippy::match-like-matches-macro` implied by `-D warnings`
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:194:9
|
||||
--> $DIR/match_same_arms2.rs:198:9
|
||||
|
|
||||
LL | Foo::X(0) => 1,
|
||||
| ---------^^^^^
|
||||
|
@ -157,13 +157,13 @@ LL | Foo::X(0) => 1,
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:196:9
|
||||
--> $DIR/match_same_arms2.rs:200:9
|
||||
|
|
||||
LL | Foo::Z(_) => 1,
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:204:9
|
||||
--> $DIR/match_same_arms2.rs:208:9
|
||||
|
|
||||
LL | Foo::Z(_) => 1,
|
||||
| ---------^^^^^
|
||||
|
@ -172,13 +172,13 @@ LL | Foo::Z(_) => 1,
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:202:9
|
||||
--> $DIR/match_same_arms2.rs:206:9
|
||||
|
|
||||
LL | Foo::X(0) => 1,
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: this match arm has an identical body to another arm
|
||||
--> $DIR/match_same_arms2.rs:227:9
|
||||
--> $DIR/match_same_arms2.rs:231:9
|
||||
|
|
||||
LL | Some(Bar { y: 0, x: 5, .. }) => 1,
|
||||
| ----------------------------^^^^^
|
||||
|
@ -187,7 +187,7 @@ LL | Some(Bar { y: 0, x: 5, .. }) => 1,
|
|||
|
|
||||
= help: or try changing either arm body
|
||||
note: other arm here
|
||||
--> $DIR/match_same_arms2.rs:224:9
|
||||
--> $DIR/match_same_arms2.rs:228:9
|
||||
|
|
||||
LL | Some(Bar { x: 0, y: 5, .. }) => 1,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::match_single_binding)]
|
||||
#![allow(unused_variables, clippy::toplevel_ref_arg)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(clippy::toplevel_ref_arg, clippy::uninlined_format_args)]
|
||||
|
||||
struct Point {
|
||||
x: i32,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::match_single_binding)]
|
||||
#![allow(unused_variables, clippy::toplevel_ref_arg)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(clippy::toplevel_ref_arg, clippy::uninlined_format_args)]
|
||||
|
||||
struct Point {
|
||||
x: i32,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::match_single_binding)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn main() {
|
||||
// Lint (additional curly braces needed, see #6572)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// run-rustfix
|
||||
|
||||
#![warn(clippy::match_single_binding)]
|
||||
#![allow(unused_variables)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
fn main() {
|
||||
// Lint (additional curly braces needed, see #6572)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// aux-build:macro_rules.rs
|
||||
|
||||
#![allow(unused, clippy::no_effect, clippy::unnecessary_operation)]
|
||||
#![warn(clippy::mut_mut)]
|
||||
#![allow(unused)]
|
||||
#![allow(clippy::no_effect, clippy::uninlined_format_args, clippy::unnecessary_operation)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate macro_rules;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// run-rustfix
|
||||
|
||||
#![feature(custom_inner_attributes, lint_reasons)]
|
||||
|
||||
#[warn(clippy::all, clippy::needless_borrow)]
|
||||
#[allow(unused_variables, clippy::unnecessary_mut_passed)]
|
||||
#[allow(unused_variables)]
|
||||
#[allow(clippy::uninlined_format_args, clippy::unnecessary_mut_passed)]
|
||||
fn main() {
|
||||
let a = 5;
|
||||
let ref_a = &a;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// run-rustfix
|
||||
|
||||
#![feature(custom_inner_attributes, lint_reasons)]
|
||||
|
||||
#[warn(clippy::all, clippy::needless_borrow)]
|
||||
#[allow(unused_variables, clippy::unnecessary_mut_passed)]
|
||||
#[allow(unused_variables)]
|
||||
#[allow(clippy::uninlined_format_args, clippy::unnecessary_mut_passed)]
|
||||
fn main() {
|
||||
let a = 5;
|
||||
let ref_a = &a;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::collections::{BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:5:39
|
||||
--> $DIR/needless_collect_indirect.rs:7:39
|
||||
|
|
||||
LL | let indirect_iter = sample.iter().collect::<Vec<_>>();
|
||||
| ^^^^^^^
|
||||
|
@ -14,7 +14,7 @@ LL ~ sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:7:38
|
||||
--> $DIR/needless_collect_indirect.rs:9:38
|
||||
|
|
||||
LL | let indirect_len = sample.iter().collect::<VecDeque<_>>();
|
||||
| ^^^^^^^
|
||||
|
@ -28,7 +28,7 @@ LL ~ sample.iter().count();
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:9:40
|
||||
--> $DIR/needless_collect_indirect.rs:11:40
|
||||
|
|
||||
LL | let indirect_empty = sample.iter().collect::<VecDeque<_>>();
|
||||
| ^^^^^^^
|
||||
|
@ -42,7 +42,7 @@ LL ~ sample.iter().next().is_none();
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:11:43
|
||||
--> $DIR/needless_collect_indirect.rs:13:43
|
||||
|
|
||||
LL | let indirect_contains = sample.iter().collect::<VecDeque<_>>();
|
||||
| ^^^^^^^
|
||||
|
@ -56,7 +56,7 @@ LL ~ sample.iter().any(|x| x == &5);
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:23:48
|
||||
--> $DIR/needless_collect_indirect.rs:25:48
|
||||
|
|
||||
LL | let non_copy_contains = sample.into_iter().collect::<Vec<_>>();
|
||||
| ^^^^^^^
|
||||
|
@ -70,7 +70,7 @@ LL ~ sample.into_iter().any(|x| x == a);
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:52:51
|
||||
--> $DIR/needless_collect_indirect.rs:54:51
|
||||
|
|
||||
LL | let buffer: Vec<&str> = string.split('/').collect();
|
||||
| ^^^^^^^
|
||||
|
@ -84,7 +84,7 @@ LL ~ string.split('/').count()
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:57:55
|
||||
--> $DIR/needless_collect_indirect.rs:59:55
|
||||
|
|
||||
LL | let indirect_len: VecDeque<_> = sample.iter().collect();
|
||||
| ^^^^^^^
|
||||
|
@ -98,7 +98,7 @@ LL ~ sample.iter().count()
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:62:57
|
||||
--> $DIR/needless_collect_indirect.rs:64:57
|
||||
|
|
||||
LL | let indirect_len: LinkedList<_> = sample.iter().collect();
|
||||
| ^^^^^^^
|
||||
|
@ -112,7 +112,7 @@ LL ~ sample.iter().count()
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:67:57
|
||||
--> $DIR/needless_collect_indirect.rs:69:57
|
||||
|
|
||||
LL | let indirect_len: BinaryHeap<_> = sample.iter().collect();
|
||||
| ^^^^^^^
|
||||
|
@ -126,7 +126,7 @@ LL ~ sample.iter().count()
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:127:59
|
||||
--> $DIR/needless_collect_indirect.rs:129:59
|
||||
|
|
||||
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
||||
| ^^^^^^^
|
||||
|
@ -143,7 +143,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == i);
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:152:59
|
||||
--> $DIR/needless_collect_indirect.rs:154:59
|
||||
|
|
||||
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
||||
| ^^^^^^^
|
||||
|
@ -160,7 +160,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:181:63
|
||||
--> $DIR/needless_collect_indirect.rs:183:63
|
||||
|
|
||||
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
||||
| ^^^^^^^
|
||||
|
@ -177,7 +177,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:217:59
|
||||
--> $DIR/needless_collect_indirect.rs:219:59
|
||||
|
|
||||
LL | let y: Vec<usize> = vec.iter().map(|k| k * k).collect();
|
||||
| ^^^^^^^
|
||||
|
@ -195,7 +195,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:242:26
|
||||
--> $DIR/needless_collect_indirect.rs:244:26
|
||||
|
|
||||
LL | let w = v.iter().collect::<Vec<_>>();
|
||||
| ^^^^^^^
|
||||
|
@ -211,7 +211,7 @@ LL ~ for _ in 0..v.iter().count() {
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:264:30
|
||||
--> $DIR/needless_collect_indirect.rs:266:30
|
||||
|
|
||||
LL | let mut w = v.iter().collect::<Vec<_>>();
|
||||
| ^^^^^^^
|
||||
|
@ -227,7 +227,7 @@ LL ~ while 1 == v.iter().count() {
|
|||
|
|
||||
|
||||
error: avoid using `collect()` when not needed
|
||||
--> $DIR/needless_collect_indirect.rs:286:30
|
||||
--> $DIR/needless_collect_indirect.rs:288:30
|
||||
|
|
||||
LL | let mut w = v.iter().collect::<Vec<_>>();
|
||||
| ^^^^^^^
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![warn(clippy::needless_continue)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
macro_rules! zero {
|
||||
($x:expr) => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this `else` block is redundant
|
||||
--> $DIR/needless_continue.rs:29:16
|
||||
--> $DIR/needless_continue.rs:30:16
|
||||
|
|
||||
LL | } else {
|
||||
| ________________^
|
||||
|
@ -35,7 +35,7 @@ LL | | }
|
|||
}
|
||||
|
||||
error: there is no need for an explicit `else` block for this `if` expression
|
||||
--> $DIR/needless_continue.rs:44:9
|
||||
--> $DIR/needless_continue.rs:45:9
|
||||
|
|
||||
LL | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
|
||||
LL | | continue;
|
||||
|
@ -55,7 +55,7 @@ LL | | }
|
|||
}
|
||||
|
||||
error: this `continue` expression is redundant
|
||||
--> $DIR/needless_continue.rs:57:9
|
||||
--> $DIR/needless_continue.rs:58:9
|
||||
|
|
||||
LL | continue; // should lint here
|
||||
| ^^^^^^^^^
|
||||
|
@ -63,7 +63,7 @@ LL | continue; // should lint here
|
|||
= help: consider dropping the `continue` expression
|
||||
|
||||
error: this `continue` expression is redundant
|
||||
--> $DIR/needless_continue.rs:64:9
|
||||
--> $DIR/needless_continue.rs:65:9
|
||||
|
|
||||
LL | continue; // should lint here
|
||||
| ^^^^^^^^^
|
||||
|
@ -71,7 +71,7 @@ LL | continue; // should lint here
|
|||
= help: consider dropping the `continue` expression
|
||||
|
||||
error: this `continue` expression is redundant
|
||||
--> $DIR/needless_continue.rs:71:9
|
||||
--> $DIR/needless_continue.rs:72:9
|
||||
|
|
||||
LL | continue // should lint here
|
||||
| ^^^^^^^^
|
||||
|
@ -79,7 +79,7 @@ LL | continue // should lint here
|
|||
= help: consider dropping the `continue` expression
|
||||
|
||||
error: this `continue` expression is redundant
|
||||
--> $DIR/needless_continue.rs:79:9
|
||||
--> $DIR/needless_continue.rs:80:9
|
||||
|
|
||||
LL | continue // should lint here
|
||||
| ^^^^^^^^
|
||||
|
@ -87,7 +87,7 @@ LL | continue // should lint here
|
|||
= help: consider dropping the `continue` expression
|
||||
|
||||
error: this `else` block is redundant
|
||||
--> $DIR/needless_continue.rs:129:24
|
||||
--> $DIR/needless_continue.rs:130:24
|
||||
|
|
||||
LL | } else {
|
||||
| ________________________^
|
||||
|
@ -110,7 +110,7 @@ LL | | }
|
|||
}
|
||||
|
||||
error: there is no need for an explicit `else` block for this `if` expression
|
||||
--> $DIR/needless_continue.rs:135:17
|
||||
--> $DIR/needless_continue.rs:136:17
|
||||
|
|
||||
LL | / if condition() {
|
||||
LL | | continue; // should lint here
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// run-rustfix
|
||||
#![warn(clippy::needless_for_each)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::needless_return,
|
||||
clippy::let_unit_value,
|
||||
clippy::match_single_binding,
|
||||
clippy::let_unit_value
|
||||
clippy::needless_return,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// run-rustfix
|
||||
#![warn(clippy::needless_for_each)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::needless_return,
|
||||
clippy::let_unit_value,
|
||||
clippy::match_single_binding,
|
||||
clippy::let_unit_value
|
||||
clippy::needless_return,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: needless use of `for_each`
|
||||
--> $DIR/needless_for_each_fixable.rs:15:5
|
||||
--> $DIR/needless_for_each_fixable.rs:16:5
|
||||
|
|
||||
LL | / v.iter().for_each(|elem| {
|
||||
LL | | acc += elem;
|
||||
|
@ -15,7 +15,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: needless use of `for_each`
|
||||
--> $DIR/needless_for_each_fixable.rs:18:5
|
||||
--> $DIR/needless_for_each_fixable.rs:19:5
|
||||
|
|
||||
LL | / v.into_iter().for_each(|elem| {
|
||||
LL | | acc += elem;
|
||||
|
@ -30,7 +30,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: needless use of `for_each`
|
||||
--> $DIR/needless_for_each_fixable.rs:22:5
|
||||
--> $DIR/needless_for_each_fixable.rs:23:5
|
||||
|
|
||||
LL | / [1, 2, 3].iter().for_each(|elem| {
|
||||
LL | | acc += elem;
|
||||
|
@ -45,7 +45,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: needless use of `for_each`
|
||||
--> $DIR/needless_for_each_fixable.rs:27:5
|
||||
--> $DIR/needless_for_each_fixable.rs:28:5
|
||||
|
|
||||
LL | / hash_map.iter().for_each(|(k, v)| {
|
||||
LL | | acc += k + v;
|
||||
|
@ -60,7 +60,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: needless use of `for_each`
|
||||
--> $DIR/needless_for_each_fixable.rs:30:5
|
||||
--> $DIR/needless_for_each_fixable.rs:31:5
|
||||
|
|
||||
LL | / hash_map.iter_mut().for_each(|(k, v)| {
|
||||
LL | | acc += *k + *v;
|
||||
|
@ -75,7 +75,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: needless use of `for_each`
|
||||
--> $DIR/needless_for_each_fixable.rs:33:5
|
||||
--> $DIR/needless_for_each_fixable.rs:34:5
|
||||
|
|
||||
LL | / hash_map.keys().for_each(|k| {
|
||||
LL | | acc += k;
|
||||
|
@ -90,7 +90,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: needless use of `for_each`
|
||||
--> $DIR/needless_for_each_fixable.rs:36:5
|
||||
--> $DIR/needless_for_each_fixable.rs:37:5
|
||||
|
|
||||
LL | / hash_map.values().for_each(|v| {
|
||||
LL | | acc += v;
|
||||
|
@ -105,7 +105,7 @@ LL + }
|
|||
|
|
||||
|
||||
error: needless use of `for_each`
|
||||
--> $DIR/needless_for_each_fixable.rs:43:5
|
||||
--> $DIR/needless_for_each_fixable.rs:44:5
|
||||
|
|
||||
LL | / my_vec().iter().for_each(|elem| {
|
||||
LL | | acc += elem;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#![warn(clippy::needless_for_each)]
|
||||
#![allow(clippy::needless_return)]
|
||||
#![allow(clippy::needless_return, clippy::uninlined_format_args)]
|
||||
|
||||
fn main() {
|
||||
let v: Vec<i32> = Vec::new();
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
// run-rustfix
|
||||
#![feature(let_chains)]
|
||||
#![allow(unused)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::assign_op_pattern,
|
||||
clippy::blocks_in_if_conditions,
|
||||
clippy::let_and_return,
|
||||
clippy::let_unit_value,
|
||||
clippy::nonminimal_bool
|
||||
clippy::nonminimal_bool,
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue