Auto merge of #12374 - Alexendoo:duplicate-diagnostics, r=Manishearth

Show duplicate diagnostics in UI tests by default

Duplicated diagnostics can indicate where redundant work is being done, this PR doesn't fix any of that but does indicate in which tests they're occurring for future investigation or to catch issues in future lints

changelog: none
This commit is contained in:
bors 2024-02-28 16:19:08 +00:00
commit af91e6ea8c
51 changed files with 379 additions and 322 deletions

View File

@ -138,6 +138,7 @@ fn base_config(test_dir: &str) -> (Config, Args) {
"-Aunused",
"-Ainternal_features",
"-Zui-testing",
"-Zdeduplicate-diagnostics=no",
"-Dwarnings",
&format!("-Ldependency={}", deps_path.display()),
]

View File

@ -8,7 +8,7 @@ note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy
note: rustc <version> running on <target>
note: compiler flags: -Z ui-testing
note: compiler flags: -Z ui-testing -Z deduplicate-diagnostics=no
note: Clippy version: foo

View File

@ -1,4 +1,6 @@
//@no-rustfix: overlapping suggestions
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![allow(clippy::uninlined_format_args)]
#[allow(unused_assignments)]

View File

@ -1,5 +1,5 @@
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:8:5
--> tests/ui/assign_ops2.rs:10:5
|
LL | a += a + 1;
| ^^^^^^^^^^
@ -16,7 +16,7 @@ LL | a = a + a + 1;
| ~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:11:5
--> tests/ui/assign_ops2.rs:13:5
|
LL | a += 1 + a;
| ^^^^^^^^^^
@ -31,7 +31,7 @@ LL | a = a + 1 + a;
| ~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:13:5
--> tests/ui/assign_ops2.rs:15:5
|
LL | a -= a - 1;
| ^^^^^^^^^^
@ -46,7 +46,7 @@ LL | a = a - (a - 1);
| ~~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:15:5
--> tests/ui/assign_ops2.rs:17:5
|
LL | a *= a * 99;
| ^^^^^^^^^^^
@ -61,7 +61,7 @@ LL | a = a * a * 99;
| ~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:17:5
--> tests/ui/assign_ops2.rs:19:5
|
LL | a *= 42 * a;
| ^^^^^^^^^^^
@ -76,7 +76,7 @@ LL | a = a * 42 * a;
| ~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:19:5
--> tests/ui/assign_ops2.rs:21:5
|
LL | a /= a / 2;
| ^^^^^^^^^^
@ -91,7 +91,7 @@ LL | a = a / (a / 2);
| ~~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:21:5
--> tests/ui/assign_ops2.rs:23:5
|
LL | a %= a % 5;
| ^^^^^^^^^^
@ -106,7 +106,7 @@ LL | a = a % (a % 5);
| ~~~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:23:5
--> tests/ui/assign_ops2.rs:25:5
|
LL | a &= a & 1;
| ^^^^^^^^^^
@ -121,7 +121,7 @@ LL | a = a & a & 1;
| ~~~~~~~~~~~~~
error: variable appears on both sides of an assignment operation
--> tests/ui/assign_ops2.rs:25:5
--> tests/ui/assign_ops2.rs:27:5
|
LL | a *= a * a;
| ^^^^^^^^^^
@ -136,7 +136,7 @@ LL | a = a * a * a;
| ~~~~~~~~~~~~~
error: manual implementation of an assign operation
--> tests/ui/assign_ops2.rs:63:5
--> tests/ui/assign_ops2.rs:65:5
|
LL | buf = buf + cows.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `buf += cows.clone()`

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::all)]
#![warn(clippy::else_if_without_else)]

View File

@ -1,5 +1,5 @@
error: `if` expression with an `else if`, but without a final `else`
--> tests/ui/else_if_without_else.rs:45:12
--> tests/ui/else_if_without_else.rs:47:12
|
LL | } else if bla2() {
| ____________^
@ -13,7 +13,7 @@ LL | | }
= help: to override `-D warnings` add `#[allow(clippy::else_if_without_else)]`
error: `if` expression with an `else if`, but without a final `else`
--> tests/ui/else_if_without_else.rs:54:12
--> tests/ui/else_if_without_else.rs:56:12
|
LL | } else if bla3() {
| ____________^

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::identity_op)]
#![allow(unused)]
#![allow(
@ -134,7 +136,7 @@ fn main() {
//~^ ERROR: this operation has no effect
f(if b { 1 } else { 2 } + 3);
//~^ ERROR: this operation has no effect
const _: i32 = { 2 * 4 } + 3;
//~^ ERROR: this operation has no effect
const _: i32 = { 1 + 2 * 3 } + 3;

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::identity_op)]
#![allow(unused)]
#![allow(
@ -134,7 +136,7 @@ fn main() {
//~^ ERROR: this operation has no effect
f(0 + if b { 1 } else { 2 } + 3);
//~^ ERROR: this operation has no effect
const _: i32 = { 2 * 4 } + 0 + 3;
//~^ ERROR: this operation has no effect
const _: i32 = 0 + { 1 + 2 * 3 } + 3;

View File

@ -1,5 +1,5 @@
error: this operation has no effect
--> tests/ui/identity_op.rs:44:5
--> tests/ui/identity_op.rs:46:5
|
LL | x + 0;
| ^^^^^ help: consider reducing it to: `x`
@ -8,310 +8,310 @@ LL | x + 0;
= help: to override `-D warnings` add `#[allow(clippy::identity_op)]`
error: this operation has no effect
--> tests/ui/identity_op.rs:46:5
--> tests/ui/identity_op.rs:48:5
|
LL | x + (1 - 1);
| ^^^^^^^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:49:5
--> tests/ui/identity_op.rs:51:5
|
LL | 0 + x;
| ^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:53:5
--> tests/ui/identity_op.rs:55:5
|
LL | x | (0);
| ^^^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:57:5
--> tests/ui/identity_op.rs:59:5
|
LL | x * 1;
| ^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:59:5
--> tests/ui/identity_op.rs:61:5
|
LL | 1 * x;
| ^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:66:5
--> tests/ui/identity_op.rs:68:5
|
LL | -1 & x;
| ^^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:70:5
--> tests/ui/identity_op.rs:72:5
|
LL | u & 255;
| ^^^^^^^ help: consider reducing it to: `u`
error: this operation has no effect
--> tests/ui/identity_op.rs:74:5
--> tests/ui/identity_op.rs:76:5
|
LL | 42 << 0;
| ^^^^^^^ help: consider reducing it to: `42`
error: this operation has no effect
--> tests/ui/identity_op.rs:76:5
--> tests/ui/identity_op.rs:78:5
|
LL | 1 >> 0;
| ^^^^^^ help: consider reducing it to: `1`
error: this operation has no effect
--> tests/ui/identity_op.rs:78:5
--> tests/ui/identity_op.rs:80:5
|
LL | 42 >> 0;
| ^^^^^^^ help: consider reducing it to: `42`
error: this operation has no effect
--> tests/ui/identity_op.rs:80:5
--> tests/ui/identity_op.rs:82:5
|
LL | &x >> 0;
| ^^^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:82:5
--> tests/ui/identity_op.rs:84:5
|
LL | x >> &0;
| ^^^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:90:5
--> tests/ui/identity_op.rs:92:5
|
LL | 2 % 3;
| ^^^^^ help: consider reducing it to: `2`
error: this operation has no effect
--> tests/ui/identity_op.rs:92:5
--> tests/ui/identity_op.rs:94:5
|
LL | -2 % 3;
| ^^^^^^ help: consider reducing it to: `-2`
error: this operation has no effect
--> tests/ui/identity_op.rs:94:5
--> tests/ui/identity_op.rs:96:5
|
LL | 2 % -3 + x;
| ^^^^^^ help: consider reducing it to: `2`
error: this operation has no effect
--> tests/ui/identity_op.rs:96:5
--> tests/ui/identity_op.rs:98:5
|
LL | -2 % -3 + x;
| ^^^^^^^ help: consider reducing it to: `-2`
error: this operation has no effect
--> tests/ui/identity_op.rs:98:9
--> tests/ui/identity_op.rs:100:9
|
LL | x + 1 % 3;
| ^^^^^ help: consider reducing it to: `1`
error: this operation has no effect
--> tests/ui/identity_op.rs:107:5
--> tests/ui/identity_op.rs:109:5
|
LL | 0 + if b { 1 } else { 2 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if b { 1 } else { 2 })`
error: this operation has no effect
--> tests/ui/identity_op.rs:109:5
--> tests/ui/identity_op.rs:111:5
|
LL | 0 + if b { 1 } else { 2 } + if b { 3 } else { 4 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if b { 1 } else { 2 })`
error: this operation has no effect
--> tests/ui/identity_op.rs:111:5
--> tests/ui/identity_op.rs:113:5
|
LL | 0 + match a { 0 => 10, _ => 20 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(match a { 0 => 10, _ => 20 })`
error: this operation has no effect
--> tests/ui/identity_op.rs:113:5
--> tests/ui/identity_op.rs:115:5
|
LL | 0 + match a { 0 => 10, _ => 20 } + match a { 0 => 30, _ => 40 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(match a { 0 => 10, _ => 20 })`
error: this operation has no effect
--> tests/ui/identity_op.rs:115:5
--> tests/ui/identity_op.rs:117:5
|
LL | 0 + if b { 1 } else { 2 } + match a { 0 => 30, _ => 40 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if b { 1 } else { 2 })`
error: this operation has no effect
--> tests/ui/identity_op.rs:117:5
--> tests/ui/identity_op.rs:119:5
|
LL | 0 + match a { 0 => 10, _ => 20 } + if b { 3 } else { 4 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(match a { 0 => 10, _ => 20 })`
error: this operation has no effect
--> tests/ui/identity_op.rs:119:5
--> tests/ui/identity_op.rs:121:5
|
LL | (if b { 1 } else { 2 }) + 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if b { 1 } else { 2 })`
error: this operation has no effect
--> tests/ui/identity_op.rs:122:5
--> tests/ui/identity_op.rs:124:5
|
LL | 0 + { a } + 3;
| ^^^^^^^^^ help: consider reducing it to: `({ a })`
error: this operation has no effect
--> tests/ui/identity_op.rs:124:5
--> tests/ui/identity_op.rs:126:5
|
LL | 0 + { a } * 2;
| ^^^^^^^^^^^^^ help: consider reducing it to: `({ a } * 2)`
error: this operation has no effect
--> tests/ui/identity_op.rs:126:5
--> tests/ui/identity_op.rs:128:5
|
LL | 0 + loop { let mut c = 0; if c == 10 { break c; } c += 1; } + { a * 2 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(loop { let mut c = 0; if c == 10 { break c; } c += 1; })`
error: this operation has no effect
--> tests/ui/identity_op.rs:133:7
--> tests/ui/identity_op.rs:135:7
|
LL | f(1 * a + { 8 * 5 });
| ^^^^^ help: consider reducing it to: `a`
error: this operation has no effect
--> tests/ui/identity_op.rs:135:7
--> tests/ui/identity_op.rs:137:7
|
LL | f(0 + if b { 1 } else { 2 } + 3);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `if b { 1 } else { 2 }`
error: this operation has no effect
--> tests/ui/identity_op.rs:138:20
--> tests/ui/identity_op.rs:140:20
|
LL | const _: i32 = { 2 * 4 } + 0 + 3;
| ^^^^^^^^^^^^^ help: consider reducing it to: `{ 2 * 4 }`
error: this operation has no effect
--> tests/ui/identity_op.rs:140:20
--> tests/ui/identity_op.rs:142:20
|
LL | const _: i32 = 0 + { 1 + 2 * 3 } + 3;
| ^^^^^^^^^^^^^^^^^ help: consider reducing it to: `{ 1 + 2 * 3 }`
error: this operation has no effect
--> tests/ui/identity_op.rs:143:5
--> tests/ui/identity_op.rs:145:5
|
LL | 0 + a as usize;
| ^^^^^^^^^^^^^^ help: consider reducing it to: `a as usize`
error: this operation has no effect
--> tests/ui/identity_op.rs:145:13
--> tests/ui/identity_op.rs:147:13
|
LL | let _ = 0 + a as usize;
| ^^^^^^^^^^^^^^ help: consider reducing it to: `a as usize`
error: this operation has no effect
--> tests/ui/identity_op.rs:147:5
--> tests/ui/identity_op.rs:149:5
|
LL | 0 + { a } as usize;
| ^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `({ a } as usize)`
error: this operation has no effect
--> tests/ui/identity_op.rs:150:9
--> tests/ui/identity_op.rs:152:9
|
LL | 2 * (0 + { a });
| ^^^^^^^^^^^ help: consider reducing it to: `{ a }`
error: this operation has no effect
--> tests/ui/identity_op.rs:152:5
--> tests/ui/identity_op.rs:154:5
|
LL | 1 * ({ a } + 4);
| ^^^^^^^^^^^^^^^ help: consider reducing it to: `(({ a } + 4))`
error: this operation has no effect
--> tests/ui/identity_op.rs:154:5
--> tests/ui/identity_op.rs:156:5
|
LL | 1 * 1;
| ^^^^^ help: consider reducing it to: `1`
error: this operation has no effect
--> tests/ui/identity_op.rs:159:18
--> tests/ui/identity_op.rs:161:18
|
LL | let _: i32 = &x + 0;
| ^^^^^^ help: consider reducing it to: `x`
error: this operation has no effect
--> tests/ui/identity_op.rs:164:5
--> tests/ui/identity_op.rs:166:5
|
LL | 0 + if a { 1 } else { 2 } + if b { 3 } else { 5 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider reducing it to: `(if a { 1 } else { 2 })`
error: this operation has no effect
--> tests/ui/identity_op.rs:175:22
--> tests/ui/identity_op.rs:177:22
|
LL | let _: i32 = *x + 0;
| ^^^^^^ help: consider reducing it to: `*x`
error: this operation has no effect
--> tests/ui/identity_op.rs:177:22
--> tests/ui/identity_op.rs:179:22
|
LL | let _: i32 = x + 0;
| ^^^^^ help: consider reducing it to: `*x`
error: this operation has no effect
--> tests/ui/identity_op.rs:182:22
--> tests/ui/identity_op.rs:184:22
|
LL | let _: i32 = **x + 0;
| ^^^^^^^ help: consider reducing it to: `**x`
error: this operation has no effect
--> tests/ui/identity_op.rs:185:22
--> tests/ui/identity_op.rs:187:22
|
LL | let _: i32 = *x + 0;
| ^^^^^^ help: consider reducing it to: `**x`
error: this operation has no effect
--> tests/ui/identity_op.rs:191:22
--> tests/ui/identity_op.rs:193:22
|
LL | let _: i32 = ***x + 0;
| ^^^^^^^^ help: consider reducing it to: `***x`
error: this operation has no effect
--> tests/ui/identity_op.rs:193:22
--> tests/ui/identity_op.rs:195:22
|
LL | let _: i32 = **x + 0;
| ^^^^^^^ help: consider reducing it to: `***x`
error: this operation has no effect
--> tests/ui/identity_op.rs:196:22
--> tests/ui/identity_op.rs:198:22
|
LL | let _: i32 = *&x + 0;
| ^^^^^^^ help: consider reducing it to: `*&x`
error: this operation has no effect
--> tests/ui/identity_op.rs:198:22
--> tests/ui/identity_op.rs:200:22
|
LL | let _: i32 = **&&x + 0;
| ^^^^^^^^^ help: consider reducing it to: `**&&x`
error: this operation has no effect
--> tests/ui/identity_op.rs:200:22
--> tests/ui/identity_op.rs:202:22
|
LL | let _: i32 = *&*&x + 0;
| ^^^^^^^^^ help: consider reducing it to: `*&*&x`
error: this operation has no effect
--> tests/ui/identity_op.rs:202:22
--> tests/ui/identity_op.rs:204:22
|
LL | let _: i32 = **&&*&x + 0;
| ^^^^^^^^^^^ help: consider reducing it to: `**&&*&x`
error: this operation has no effect
--> tests/ui/identity_op.rs:209:22
|
LL | let _: i32 = **&&*&x + 0;
| ^^^^^^^^^^^ help: consider reducing it to: `***&&*&x`
error: this operation has no effect
--> tests/ui/identity_op.rs:211:22
|
LL | let _: i32 = **&&*&x + 0;
| ^^^^^^^^^^^ help: consider reducing it to: `***&&*&x`
error: this operation has no effect
--> tests/ui/identity_op.rs:213:22
|
LL | let _: i32 = **&&*&x + 0;
| ^^^^^^^^^^^ help: consider reducing it to: `***&&*&x`
error: aborting due to 52 previous errors

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![feature(inline_const)]
#![warn(clippy::indexing_slicing)]
// We also check the out_of_bounds_indexing lint here, because it lints similar things and

View File

@ -1,5 +1,5 @@
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:14:20
--> tests/ui/indexing_slicing_index.rs:16:20
|
LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-restriction-lint-in-const` default is false.
| ^^^^^^^^^^
@ -10,19 +10,19 @@ LL | const REF: &i32 = &ARR[idx()]; // This should be linted, since `suppress-re
= help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]`
error[E0080]: evaluation of `main::{constant#3}` failed
--> tests/ui/indexing_slicing_index.rs:46:14
--> tests/ui/indexing_slicing_index.rs:48:14
|
LL | const { &ARR[idx4()] };
| ^^^^^^^^^^^ index out of bounds: the length is 2 but the index is 4
note: erroneous constant encountered
--> tests/ui/indexing_slicing_index.rs:46:5
--> tests/ui/indexing_slicing_index.rs:48:5
|
LL | const { &ARR[idx4()] };
| ^^^^^^^^^^^^^^^^^^^^^^
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:27:5
--> tests/ui/indexing_slicing_index.rs:29:5
|
LL | x[index];
| ^^^^^^^^
@ -30,7 +30,7 @@ LL | x[index];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:30:5
--> tests/ui/indexing_slicing_index.rs:32:5
|
LL | x[4];
| ^^^^
@ -39,13 +39,13 @@ LL | x[4];
= help: to override `-D warnings` add `#[allow(clippy::out_of_bounds_indexing)]`
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:32:5
--> tests/ui/indexing_slicing_index.rs:34:5
|
LL | x[1 << 3];
| ^^^^^^^^^
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:43:14
--> tests/ui/indexing_slicing_index.rs:45:14
|
LL | const { &ARR[idx()] };
| ^^^^^^^^^^
@ -54,7 +54,7 @@ LL | const { &ARR[idx()] };
= note: the suggestion might not be applicable in constant blocks
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:46:14
--> tests/ui/indexing_slicing_index.rs:48:14
|
LL | const { &ARR[idx4()] };
| ^^^^^^^^^^^
@ -63,13 +63,13 @@ LL | const { &ARR[idx4()] };
= note: the suggestion might not be applicable in constant blocks
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:53:5
--> tests/ui/indexing_slicing_index.rs:55:5
|
LL | y[4];
| ^^^^
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:56:5
--> tests/ui/indexing_slicing_index.rs:58:5
|
LL | v[0];
| ^^^^
@ -77,7 +77,7 @@ LL | v[0];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:58:5
--> tests/ui/indexing_slicing_index.rs:60:5
|
LL | v[10];
| ^^^^^
@ -85,7 +85,7 @@ LL | v[10];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:60:5
--> tests/ui/indexing_slicing_index.rs:62:5
|
LL | v[1 << 3];
| ^^^^^^^^^
@ -93,13 +93,13 @@ LL | v[1 << 3];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:68:5
--> tests/ui/indexing_slicing_index.rs:70:5
|
LL | x[N];
| ^^^^
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:71:5
--> tests/ui/indexing_slicing_index.rs:73:5
|
LL | v[N];
| ^^^^
@ -107,7 +107,7 @@ LL | v[N];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: indexing may panic
--> tests/ui/indexing_slicing_index.rs:73:5
--> tests/ui/indexing_slicing_index.rs:75:5
|
LL | v[M];
| ^^^^
@ -115,7 +115,7 @@ LL | v[M];
= help: consider using `.get(n)` or `.get_mut(n)` instead
error: index is out of bounds
--> tests/ui/indexing_slicing_index.rs:77:13
--> tests/ui/indexing_slicing_index.rs:79:13
|
LL | let _ = x[4];
| ^^^^

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::manual_retain)]
#![allow(unused, clippy::redundant_clone)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::manual_retain)]
#![allow(unused, clippy::redundant_clone)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

View File

@ -1,5 +1,5 @@
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:25:5
--> tests/ui/manual_retain.rs:27:5
|
LL | binary_heap = binary_heap.into_iter().filter(|x| x % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
@ -8,43 +8,43 @@ LL | binary_heap = binary_heap.into_iter().filter(|x| x % 2 == 0).collect();
= help: to override `-D warnings` add `#[allow(clippy::manual_retain)]`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:26:5
--> tests/ui/manual_retain.rs:28:5
|
LL | binary_heap = binary_heap.iter().filter(|&x| x % 2 == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:27:5
--> tests/ui/manual_retain.rs:29:5
|
LL | binary_heap = binary_heap.iter().filter(|&x| x % 2 == 0).cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `binary_heap.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:31:5
--> tests/ui/manual_retain.rs:33:5
|
LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:32:5
--> tests/ui/manual_retain.rs:34:5
|
LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:62:5
--> tests/ui/manual_retain.rs:64:5
|
LL | btree_map = btree_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|k, _| k % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:63:5
--> tests/ui/manual_retain.rs:65:5
|
LL | btree_map = btree_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_map.retain(|_, &mut v| v % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:64:5
--> tests/ui/manual_retain.rs:66:5
|
LL | / btree_map = btree_map
LL | | .into_iter()
@ -53,49 +53,49 @@ LL | | .collect();
| |__________________^ help: consider calling `.retain()` instead: `btree_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:89:5
--> tests/ui/manual_retain.rs:91:5
|
LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:90:5
--> tests/ui/manual_retain.rs:92:5
|
LL | btree_set = btree_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:91:5
--> tests/ui/manual_retain.rs:93:5
|
LL | btree_set = btree_set.into_iter().filter(|x| x % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `btree_set.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:95:5
--> tests/ui/manual_retain.rs:97:5
|
LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:96:5
--> tests/ui/manual_retain.rs:98:5
|
LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:126:5
--> tests/ui/manual_retain.rs:128:5
|
LL | hash_map = hash_map.into_iter().filter(|(k, _)| k % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|k, _| k % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:127:5
--> tests/ui/manual_retain.rs:129:5
|
LL | hash_map = hash_map.into_iter().filter(|(_, v)| v % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_map.retain(|_, &mut v| v % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:128:5
--> tests/ui/manual_retain.rs:130:5
|
LL | / hash_map = hash_map
LL | | .into_iter()
@ -104,133 +104,133 @@ LL | | .collect();
| |__________________^ help: consider calling `.retain()` instead: `hash_map.retain(|k, &mut v| (k % 2 == 0) && (v % 2 == 0))`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:152:5
--> tests/ui/manual_retain.rs:154:5
|
LL | hash_set = hash_set.into_iter().filter(|x| x % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:153:5
--> tests/ui/manual_retain.rs:155:5
|
LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:154:5
--> tests/ui/manual_retain.rs:156:5
|
LL | hash_set = hash_set.iter().filter(|&x| x % 2 == 0).cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `hash_set.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:158:5
--> tests/ui/manual_retain.rs:160:5
|
LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:159:5
--> tests/ui/manual_retain.rs:161:5
|
LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:188:5
--> tests/ui/manual_retain.rs:190:5
|
LL | s = s.chars().filter(|&c| c != 'o').to_owned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `s.retain(|c| c != 'o')`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:200:5
--> tests/ui/manual_retain.rs:202:5
|
LL | vec = vec.iter().filter(|&x| x % 2 == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:201:5
--> tests/ui/manual_retain.rs:203:5
|
LL | vec = vec.iter().filter(|&x| x % 2 == 0).cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:202:5
--> tests/ui/manual_retain.rs:204:5
|
LL | vec = vec.into_iter().filter(|x| x % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:206:5
--> tests/ui/manual_retain.rs:208:5
|
LL | tuples = tuples.iter().filter(|(ref x, ref y)| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(ref x, ref y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:207:5
--> tests/ui/manual_retain.rs:209:5
|
LL | tuples = tuples.iter().filter(|(x, y)| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(x, y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:229:5
--> tests/ui/manual_retain.rs:231:5
|
LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:230:5
--> tests/ui/manual_retain.rs:232:5
|
LL | vec_deque = vec_deque.iter().filter(|&x| x % 2 == 0).cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:231:5
--> tests/ui/manual_retain.rs:233:5
|
LL | vec_deque = vec_deque.into_iter().filter(|x| x % 2 == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec_deque.retain(|x| x % 2 == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:288:5
--> tests/ui/manual_retain.rs:290:5
|
LL | vec = vec.into_iter().filter(|(x, y)| *x == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|(x, y)| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:292:5
--> tests/ui/manual_retain.rs:294:5
|
LL | tuples = tuples.into_iter().filter(|(_, n)| *n > 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `tuples.retain(|(_, n)| *n > 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:309:5
--> tests/ui/manual_retain.rs:311:5
|
LL | vec = vec.iter().filter(|&&x| x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:310:5
--> tests/ui/manual_retain.rs:312:5
|
LL | vec = vec.iter().filter(|&&x| x == 0).cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:311:5
--> tests/ui/manual_retain.rs:313:5
|
LL | vec = vec.into_iter().filter(|&x| x == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|&x| x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:314:5
--> tests/ui/manual_retain.rs:316:5
|
LL | vec = vec.iter().filter(|&x| *x == 0).copied().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:315:5
--> tests/ui/manual_retain.rs:317:5
|
LL | vec = vec.iter().filter(|&x| *x == 0).cloned().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`
error: this expression can be written more simply using `.retain()`
--> tests/ui/manual_retain.rs:316:5
--> tests/ui/manual_retain.rs:318:5
|
LL | vec = vec.into_iter().filter(|x| *x == 0).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling `.retain()` instead: `vec.retain(|x| *x == 0)`

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![allow(clippy::too_many_arguments, clippy::diverging_sub_expression)]
#![warn(clippy::many_single_char_names)]

View File

@ -1,5 +1,5 @@
error: 5 bindings with single-character names in scope
--> tests/ui/many_single_char_names.rs:5:9
--> tests/ui/many_single_char_names.rs:7:9
|
LL | let a: i32;
| ^
@ -14,7 +14,7 @@ LL | let e: i32;
= help: to override `-D warnings` add `#[allow(clippy::many_single_char_names)]`
error: 6 bindings with single-character names in scope
--> tests/ui/many_single_char_names.rs:5:9
--> tests/ui/many_single_char_names.rs:7:9
|
LL | let a: i32;
| ^
@ -28,7 +28,7 @@ LL | let f: i32;
| ^
error: 5 bindings with single-character names in scope
--> tests/ui/many_single_char_names.rs:5:9
--> tests/ui/many_single_char_names.rs:7:9
|
LL | let a: i32;
| ^
@ -40,13 +40,13 @@ LL | e => panic!(),
| ^
error: 8 bindings with single-character names in scope
--> tests/ui/many_single_char_names.rs:34:13
--> tests/ui/many_single_char_names.rs:36:13
|
LL | fn bindings(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) {}
| ^ ^ ^ ^ ^ ^ ^ ^
error: 8 bindings with single-character names in scope
--> tests/ui/many_single_char_names.rs:38:10
--> tests/ui/many_single_char_names.rs:40:10
|
LL | let (a, b, c, d, e, f, g, h): (bool, bool, bool, bool, bool, bool, bool, bool) = unimplemented!();
| ^ ^ ^ ^ ^ ^ ^ ^

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![feature(custom_inner_attributes)]
#![clippy::msrv = "invalid.version"]
//~^ ERROR: `invalid.version` is not a valid Rust version

View File

@ -1,35 +1,35 @@
error: `invalid.version` is not a valid Rust version
--> tests/ui/min_rust_version_invalid_attr.rs:2:1
--> tests/ui/min_rust_version_invalid_attr.rs:4:1
|
LL | #![clippy::msrv = "invalid.version"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `invalid.version` is not a valid Rust version
--> tests/ui/min_rust_version_invalid_attr.rs:7:1
--> tests/ui/min_rust_version_invalid_attr.rs:9:1
|
LL | #[clippy::msrv = "invalid.version"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `clippy::msrv` is defined multiple times
--> tests/ui/min_rust_version_invalid_attr.rs:14:5
--> tests/ui/min_rust_version_invalid_attr.rs:16:5
|
LL | #![clippy::msrv = "1.10.1"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first definition found here
--> tests/ui/min_rust_version_invalid_attr.rs:12:5
--> tests/ui/min_rust_version_invalid_attr.rs:14:5
|
LL | #![clippy::msrv = "1.40"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: `clippy::msrv` is defined multiple times
--> tests/ui/min_rust_version_invalid_attr.rs:19:9
--> tests/ui/min_rust_version_invalid_attr.rs:21:9
|
LL | #![clippy::msrv = "1.0.0"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first definition found here
--> tests/ui/min_rust_version_invalid_attr.rs:18:9
--> tests/ui/min_rust_version_invalid_attr.rs:20:9
|
LL | #![clippy::msrv = "1"]
| ^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,6 @@
//@aux-build:proc_macros.rs
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::mut_mut)]
#![allow(unused)]
#![allow(

View File

@ -1,5 +1,5 @@
error: generally you want to avoid `&mut &mut _` if possible
--> tests/ui/mut_mut.rs:14:11
--> tests/ui/mut_mut.rs:16:11
|
LL | fn fun(x: &mut &mut u32) -> bool {
| ^^^^^^^^^^^^^
@ -8,13 +8,13 @@ LL | fn fun(x: &mut &mut u32) -> bool {
= help: to override `-D warnings` add `#[allow(clippy::mut_mut)]`
error: generally you want to avoid `&mut &mut _` if possible
--> tests/ui/mut_mut.rs:31:17
--> tests/ui/mut_mut.rs:33:17
|
LL | let mut x = &mut &mut 1u32;
| ^^^^^^^^^^^^^^
error: generally you want to avoid `&mut &mut _` if possible
--> tests/ui/mut_mut.rs:46:25
--> tests/ui/mut_mut.rs:48:25
|
LL | let mut z = inline!(&mut $(&mut 3u32));
| ^
@ -22,37 +22,37 @@ LL | let mut z = inline!(&mut $(&mut 3u32));
= note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info)
error: this expression mutably borrows a mutable reference. Consider reborrowing
--> tests/ui/mut_mut.rs:33:21
--> tests/ui/mut_mut.rs:35:21
|
LL | let mut y = &mut x;
| ^^^^^^
error: generally you want to avoid `&mut &mut _` if possible
--> tests/ui/mut_mut.rs:37:32
--> tests/ui/mut_mut.rs:39:32
|
LL | let y: &mut &mut u32 = &mut &mut 2;
| ^^^^^^^^^^^
error: generally you want to avoid `&mut &mut _` if possible
--> tests/ui/mut_mut.rs:37:16
--> tests/ui/mut_mut.rs:39:16
|
LL | let y: &mut &mut u32 = &mut &mut 2;
| ^^^^^^^^^^^^^
error: generally you want to avoid `&mut &mut _` if possible
--> tests/ui/mut_mut.rs:42:37
--> tests/ui/mut_mut.rs:44:37
|
LL | let y: &mut &mut &mut u32 = &mut &mut &mut 2;
| ^^^^^^^^^^^^^^^^
error: generally you want to avoid `&mut &mut _` if possible
--> tests/ui/mut_mut.rs:42:16
--> tests/ui/mut_mut.rs:44:16
|
LL | let y: &mut &mut &mut u32 = &mut &mut &mut 2;
| ^^^^^^^^^^^^^^^^^^
error: generally you want to avoid `&mut &mut _` if possible
--> tests/ui/mut_mut.rs:42:21
--> tests/ui/mut_mut.rs:44:21
|
LL | let y: &mut &mut &mut u32 = &mut &mut &mut 2;
| ^^^^^^^^^^^^^

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::no_effect_replace)]
fn main() {

View File

@ -1,5 +1,5 @@
error: replacing text with itself
--> tests/ui/no_effect_replace.rs:4:13
--> tests/ui/no_effect_replace.rs:6:13
|
LL | let _ = "12345".replace('1', "1");
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -8,43 +8,43 @@ LL | let _ = "12345".replace('1', "1");
= help: to override `-D warnings` add `#[allow(clippy::no_effect_replace)]`
error: replacing text with itself
--> tests/ui/no_effect_replace.rs:7:13
--> tests/ui/no_effect_replace.rs:9:13
|
LL | let _ = "12345".replace("12", "12");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: replacing text with itself
--> tests/ui/no_effect_replace.rs:9:13
--> tests/ui/no_effect_replace.rs:11:13
|
LL | let _ = String::new().replace("12", "12");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: replacing text with itself
--> tests/ui/no_effect_replace.rs:12:13
--> tests/ui/no_effect_replace.rs:14:13
|
LL | let _ = "12345".replacen('1', "1", 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: replacing text with itself
--> tests/ui/no_effect_replace.rs:14:13
--> tests/ui/no_effect_replace.rs:16:13
|
LL | let _ = "12345".replacen("12", "12", 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: replacing text with itself
--> tests/ui/no_effect_replace.rs:16:13
--> tests/ui/no_effect_replace.rs:18:13
|
LL | let _ = String::new().replacen("12", "12", 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: replacing text with itself
--> tests/ui/no_effect_replace.rs:23:13
--> tests/ui/no_effect_replace.rs:25:13
|
LL | let _ = "hello".replace(&x.f(), &x.f());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: replacing text with itself
--> tests/ui/no_effect_replace.rs:27:13
--> tests/ui/no_effect_replace.rs:29:13
|
LL | let _ = "hello".replace(&y(), &y());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,6 @@
//@no-rustfix: overlapping suggestions
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![feature(lint_reasons)]
#![allow(
unused,

View File

@ -1,5 +1,5 @@
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:18:13
--> tests/ui/nonminimal_bool.rs:20:13
|
LL | let _ = !true;
| ^^^^^ help: try: `false`
@ -8,43 +8,43 @@ LL | let _ = !true;
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:21:13
--> tests/ui/nonminimal_bool.rs:23:13
|
LL | let _ = !false;
| ^^^^^^ help: try: `true`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:23:13
--> tests/ui/nonminimal_bool.rs:25:13
|
LL | let _ = !!a;
| ^^^ help: try: `a`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:25:13
--> tests/ui/nonminimal_bool.rs:27:13
|
LL | let _ = false || a;
| ^^^^^^^^^^ help: try: `a`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:30:13
--> tests/ui/nonminimal_bool.rs:32:13
|
LL | let _ = !(!a && b);
| ^^^^^^^^^^ help: try: `a || !b`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:32:13
--> tests/ui/nonminimal_bool.rs:34:13
|
LL | let _ = !(!a || b);
| ^^^^^^^^^^ help: try: `a && !b`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:34:13
--> tests/ui/nonminimal_bool.rs:36:13
|
LL | let _ = !a && !(b && c);
| ^^^^^^^^^^^^^^^ help: try: `!(a || b && c)`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:43:13
--> tests/ui/nonminimal_bool.rs:45:13
|
LL | let _ = a == b && c == 5 && a == b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -57,7 +57,7 @@ LL | let _ = a == b && c == 5;
| ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:45:13
--> tests/ui/nonminimal_bool.rs:47:13
|
LL | let _ = a == b || c == 5 || a == b;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -70,7 +70,7 @@ LL | let _ = a == b || c == 5;
| ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:47:13
--> tests/ui/nonminimal_bool.rs:49:13
|
LL | let _ = a == b && c == 5 && b == a;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -83,7 +83,7 @@ LL | let _ = a == b && c == 5;
| ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:49:13
--> tests/ui/nonminimal_bool.rs:51:13
|
LL | let _ = a != b || !(a != b || c == d);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -96,7 +96,7 @@ LL | let _ = a != b || c != d;
| ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:51:13
--> tests/ui/nonminimal_bool.rs:53:13
|
LL | let _ = a != b && !(a != b && c == d);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -109,43 +109,43 @@ LL | let _ = a != b && c != d;
| ~~~~~~~~~~~~~~~~
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:82:8
--> tests/ui/nonminimal_bool.rs:84:8
|
LL | if matches!(true, true) && true {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:162:8
--> tests/ui/nonminimal_bool.rs:164:8
|
LL | if !(12 == a) {}
| ^^^^^^^^^^ help: try: `12 != a`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:163:8
--> tests/ui/nonminimal_bool.rs:165:8
|
LL | if !(a == 12) {}
| ^^^^^^^^^^ help: try: `a != 12`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:164:8
--> tests/ui/nonminimal_bool.rs:166:8
|
LL | if !(12 != a) {}
| ^^^^^^^^^^ help: try: `12 == a`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:165:8
--> tests/ui/nonminimal_bool.rs:167:8
|
LL | if !(a != 12) {}
| ^^^^^^^^^^ help: try: `a == 12`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:169:8
--> tests/ui/nonminimal_bool.rs:171:8
|
LL | if !b == true {}
| ^^^^^^^^^^ help: try: `b != true`
error: this comparison might be written more concisely
--> tests/ui/nonminimal_bool.rs:169:8
--> tests/ui/nonminimal_bool.rs:171:8
|
LL | if !b == true {}
| ^^^^^^^^^^ help: try simplifying it as shown: `b != true`
@ -154,61 +154,61 @@ LL | if !b == true {}
= help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]`
error: equality checks against true are unnecessary
--> tests/ui/nonminimal_bool.rs:169:8
--> tests/ui/nonminimal_bool.rs:171:8
|
LL | if !b == true {}
| ^^^^^^^^^^ help: try simplifying it as shown: `!b`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:170:8
--> tests/ui/nonminimal_bool.rs:172:8
|
LL | if !b != true {}
| ^^^^^^^^^^ help: try: `b == true`
error: inequality checks against true can be replaced by a negation
--> tests/ui/nonminimal_bool.rs:170:8
--> tests/ui/nonminimal_bool.rs:172:8
|
LL | if !b != true {}
| ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:171:8
--> tests/ui/nonminimal_bool.rs:173:8
|
LL | if true == !b {}
| ^^^^^^^^^^ help: try: `true != b`
error: this comparison might be written more concisely
--> tests/ui/nonminimal_bool.rs:171:8
--> tests/ui/nonminimal_bool.rs:173:8
|
LL | if true == !b {}
| ^^^^^^^^^^ help: try simplifying it as shown: `true != b`
error: equality checks against true are unnecessary
--> tests/ui/nonminimal_bool.rs:171:8
--> tests/ui/nonminimal_bool.rs:173:8
|
LL | if true == !b {}
| ^^^^^^^^^^ help: try simplifying it as shown: `!b`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:172:8
--> tests/ui/nonminimal_bool.rs:174:8
|
LL | if true != !b {}
| ^^^^^^^^^^ help: try: `true == b`
error: inequality checks against true can be replaced by a negation
--> tests/ui/nonminimal_bool.rs:172:8
--> tests/ui/nonminimal_bool.rs:174:8
|
LL | if true != !b {}
| ^^^^^^^^^^ help: try simplifying it as shown: `!(!b)`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:173:8
--> tests/ui/nonminimal_bool.rs:175:8
|
LL | if !b == !c {}
| ^^^^^^^^ help: try: `b == c`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool.rs:174:8
--> tests/ui/nonminimal_bool.rs:176:8
|
LL | if !b != !c {}
| ^^^^^^^^ help: try: `b != c`

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![allow(unused, clippy::diverging_sub_expression, clippy::needless_if)]
#![warn(clippy::nonminimal_bool)]

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![allow(unused, clippy::diverging_sub_expression, clippy::needless_if)]
#![warn(clippy::nonminimal_bool)]

View File

@ -1,5 +1,5 @@
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:8:13
--> tests/ui/nonminimal_bool_methods.rs:10:13
|
LL | let _ = !a.is_some();
| ^^^^^^^^^^^^ help: try: `a.is_none()`
@ -8,73 +8,73 @@ LL | let _ = !a.is_some();
= help: to override `-D warnings` add `#[allow(clippy::nonminimal_bool)]`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:10:13
--> tests/ui/nonminimal_bool_methods.rs:12:13
|
LL | let _ = !a.is_none();
| ^^^^^^^^^^^^ help: try: `a.is_some()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:12:13
--> tests/ui/nonminimal_bool_methods.rs:14:13
|
LL | let _ = !b.is_err();
| ^^^^^^^^^^^ help: try: `b.is_ok()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:14:13
--> tests/ui/nonminimal_bool_methods.rs:16:13
|
LL | let _ = !b.is_ok();
| ^^^^^^^^^^ help: try: `b.is_err()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:16:13
--> tests/ui/nonminimal_bool_methods.rs:18:13
|
LL | let _ = !(a.is_some() && !c);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() || c`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:17:13
--> tests/ui/nonminimal_bool_methods.rs:19:13
|
LL | let _ = !(a.is_some() || !c);
| ^^^^^^^^^^^^^^^^^^^^ help: try: `a.is_none() && c`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:18:26
--> tests/ui/nonminimal_bool_methods.rs:20:26
|
LL | let _ = !(!c ^ c) || !a.is_some();
| ^^^^^^^^^^^^ help: try: `a.is_none()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:19:25
--> tests/ui/nonminimal_bool_methods.rs:21:25
|
LL | let _ = (!c ^ c) || !a.is_some();
| ^^^^^^^^^^^^ help: try: `a.is_none()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:20:23
--> tests/ui/nonminimal_bool_methods.rs:22:23
|
LL | let _ = !c ^ c || !a.is_some();
| ^^^^^^^^^^^^ help: try: `a.is_none()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:92:8
--> tests/ui/nonminimal_bool_methods.rs:94:8
|
LL | if !res.is_ok() {}
| ^^^^^^^^^^^^ help: try: `res.is_err()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:93:8
--> tests/ui/nonminimal_bool_methods.rs:95:8
|
LL | if !res.is_err() {}
| ^^^^^^^^^^^^^ help: try: `res.is_ok()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:96:8
--> tests/ui/nonminimal_bool_methods.rs:98:8
|
LL | if !res.is_some() {}
| ^^^^^^^^^^^^^^ help: try: `res.is_none()`
error: this boolean expression can be simplified
--> tests/ui/nonminimal_bool_methods.rs:97:8
--> tests/ui/nonminimal_bool_methods.rs:99:8
|
LL | if !res.is_none() {}
| ^^^^^^^^^^^^^^ help: try: `res.is_some()`

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![deny(clippy::option_option)]
#![allow(clippy::unnecessary_wraps)]

View File

@ -1,77 +1,77 @@
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:4:10
--> tests/ui/option_option.rs:6:10
|
LL | const C: Option<Option<i32>> = None;
| ^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> tests/ui/option_option.rs:1:9
--> tests/ui/option_option.rs:3:9
|
LL | #![deny(clippy::option_option)]
| ^^^^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:6:11
--> tests/ui/option_option.rs:8:11
|
LL | static S: Option<Option<i32>> = None;
| ^^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:9:13
--> tests/ui/option_option.rs:11:13
|
LL | fn input(_: Option<Option<u8>>) {}
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:12:16
--> tests/ui/option_option.rs:14:16
|
LL | fn output() -> Option<Option<u8>> {
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:17:27
--> tests/ui/option_option.rs:19:27
|
LL | fn output_nested() -> Vec<Option<Option<u8>>> {
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:23:30
--> tests/ui/option_option.rs:25:30
|
LL | fn output_nested_nested() -> Option<Option<Option<u8>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:29:8
--> tests/ui/option_option.rs:31:8
|
LL | x: Option<Option<u8>>,
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:34:23
--> tests/ui/option_option.rs:36:23
|
LL | fn struct_fn() -> Option<Option<u8>> {
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:41:22
--> tests/ui/option_option.rs:43:22
|
LL | fn trait_fn() -> Option<Option<u8>>;
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:46:11
--> tests/ui/option_option.rs:48:11
|
LL | Tuple(Option<Option<u8>>),
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:48:17
--> tests/ui/option_option.rs:50:17
|
LL | Struct { x: Option<Option<u8>> },
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> tests/ui/option_option.rs:90:14
--> tests/ui/option_option.rs:92:14
|
LL | foo: Option<Option<Cow<'a, str>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,4 +1,5 @@
//@aux-build:proc_macros.rs
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::ptr_as_ptr)]

View File

@ -1,4 +1,5 @@
//@aux-build:proc_macros.rs
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::ptr_as_ptr)]

View File

@ -1,5 +1,5 @@
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:18:33
--> tests/ui/ptr_as_ptr.rs:19:33
|
LL | *unsafe { Box::from_raw(Box::into_raw(Box::new(o)) as *mut super::issue_11278_a::T<String>) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `Box::into_raw(Box::new(o)).cast::<super::issue_11278_a::T<String>>()`
@ -8,37 +8,37 @@ LL | *unsafe { Box::from_raw(Box::into_raw(Box::new(o)) as *mut super::i
= help: to override `-D warnings` add `#[allow(clippy::ptr_as_ptr)]`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:27:13
--> tests/ui/ptr_as_ptr.rs:28:13
|
LL | let _ = ptr as *const i32;
| ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:28:13
--> tests/ui/ptr_as_ptr.rs:29:13
|
LL | let _ = mut_ptr as *mut i32;
| ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:33:17
--> tests/ui/ptr_as_ptr.rs:34:17
|
LL | let _ = *ptr_ptr as *const i32;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `(*ptr_ptr).cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:46:25
--> tests/ui/ptr_as_ptr.rs:47:25
|
LL | let _: *const i32 = ptr as *const _;
| ^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:47:23
--> tests/ui/ptr_as_ptr.rs:48:23
|
LL | let _: *mut i32 = mut_ptr as _;
| ^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:50:21
--> tests/ui/ptr_as_ptr.rs:51:21
|
LL | let _ = inline!($ptr as *const i32);
| ^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `$ptr.cast::<i32>()`
@ -46,157 +46,157 @@ LL | let _ = inline!($ptr as *const i32);
= note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:71:13
--> tests/ui/ptr_as_ptr.rs:72:13
|
LL | let _ = ptr as *const i32;
| ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:72:13
--> tests/ui/ptr_as_ptr.rs:73:13
|
LL | let _ = mut_ptr as *mut i32;
| ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:79:9
--> tests/ui/ptr_as_ptr.rs:80:9
|
LL | ptr::null_mut() as *mut u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut::<u32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:83:9
--> tests/ui/ptr_as_ptr.rs:84:9
|
LL | std::ptr::null_mut() as *mut u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut::<u32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:88:9
--> tests/ui/ptr_as_ptr.rs:89:9
|
LL | ptr::null_mut() as *mut u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut::<u32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:92:9
--> tests/ui/ptr_as_ptr.rs:93:9
|
LL | core::ptr::null_mut() as *mut u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut::<u32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:97:9
--> tests/ui/ptr_as_ptr.rs:98:9
|
LL | ptr::null() as *const u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null::<u32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:101:9
--> tests/ui/ptr_as_ptr.rs:102:9
|
LL | std::ptr::null() as *const u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null::<u32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:106:9
--> tests/ui/ptr_as_ptr.rs:107:9
|
LL | ptr::null() as *const u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null::<u32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:110:9
--> tests/ui/ptr_as_ptr.rs:111:9
|
LL | core::ptr::null() as *const u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null::<u32>()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:117:9
--> tests/ui/ptr_as_ptr.rs:118:9
|
LL | ptr::null_mut() as *mut _
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:121:9
--> tests/ui/ptr_as_ptr.rs:122:9
|
LL | std::ptr::null_mut() as *mut _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:126:9
--> tests/ui/ptr_as_ptr.rs:127:9
|
LL | ptr::null_mut() as *mut _
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:130:9
--> tests/ui/ptr_as_ptr.rs:131:9
|
LL | core::ptr::null_mut() as *mut _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:135:9
--> tests/ui/ptr_as_ptr.rs:136:9
|
LL | ptr::null() as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:139:9
--> tests/ui/ptr_as_ptr.rs:140:9
|
LL | std::ptr::null() as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:144:9
--> tests/ui/ptr_as_ptr.rs:145:9
|
LL | ptr::null() as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:148:9
--> tests/ui/ptr_as_ptr.rs:149:9
|
LL | core::ptr::null() as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:155:9
--> tests/ui/ptr_as_ptr.rs:156:9
|
LL | ptr::null_mut() as _
| ^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:159:9
--> tests/ui/ptr_as_ptr.rs:160:9
|
LL | std::ptr::null_mut() as _
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:164:9
--> tests/ui/ptr_as_ptr.rs:165:9
|
LL | ptr::null_mut() as _
| ^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:168:9
--> tests/ui/ptr_as_ptr.rs:169:9
|
LL | core::ptr::null_mut() as _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:173:9
--> tests/ui/ptr_as_ptr.rs:174:9
|
LL | ptr::null() as _
| ^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:177:9
--> tests/ui/ptr_as_ptr.rs:178:9
|
LL | std::ptr::null() as _
| ^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:182:9
--> tests/ui/ptr_as_ptr.rs:183:9
|
LL | ptr::null() as _
| ^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()`
error: `as` casting between raw pointers without changing its mutability
--> tests/ui/ptr_as_ptr.rs:186:9
--> tests/ui/ptr_as_ptr.rs:187:9
|
LL | core::ptr::null() as _
| ^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null()`

View File

@ -1,2 +1,4 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#[clippy::cognitive_complexity = "1"]
fn main() {}

View File

@ -1,2 +1,4 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#[clippy::cyclomatic_complexity = "1"]
fn main() {}

View File

@ -1,5 +1,5 @@
error: usage of deprecated attribute
--> tests/ui/renamed_builtin_attr.rs:1:11
--> tests/ui/renamed_builtin_attr.rs:3:11
|
LL | #[clippy::cyclomatic_complexity = "1"]
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using: `cognitive_complexity`

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::single_match)]
#![allow(
unused,

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::single_match)]
#![allow(
unused,

View File

@ -1,5 +1,5 @@
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:14:5
--> tests/ui/single_match.rs:16:5
|
LL | / match x {
LL | | Some(y) => {
@ -19,7 +19,7 @@ LL ~ };
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:22:5
--> tests/ui/single_match.rs:24:5
|
LL | / match x {
LL | | // Note the missing block braces.
@ -31,7 +31,7 @@ LL | | }
| |_____^ help: try: `if let Some(y) = x { println!("{:?}", y) }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:31:5
--> tests/ui/single_match.rs:33:5
|
LL | / match z {
LL | | (2..=3, 7..=9) => dummy(),
@ -40,7 +40,7 @@ LL | | };
| |_____^ help: try: `if let (2..=3, 7..=9) = z { dummy() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:60:5
--> tests/ui/single_match.rs:62:5
|
LL | / match x {
LL | | Some(y) => dummy(),
@ -49,7 +49,7 @@ LL | | };
| |_____^ help: try: `if let Some(y) = x { dummy() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:65:5
--> tests/ui/single_match.rs:67:5
|
LL | / match y {
LL | | Ok(y) => dummy(),
@ -58,7 +58,7 @@ LL | | };
| |_____^ help: try: `if let Ok(y) = y { dummy() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:72:5
--> tests/ui/single_match.rs:74:5
|
LL | / match c {
LL | | Cow::Borrowed(..) => dummy(),
@ -67,7 +67,7 @@ LL | | };
| |_____^ help: try: `if let Cow::Borrowed(..) = c { dummy() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:93:5
--> tests/ui/single_match.rs:95:5
|
LL | / match x {
LL | | "test" => println!(),
@ -76,7 +76,7 @@ LL | | }
| |_____^ help: try: `if x == "test" { println!() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:106:5
--> tests/ui/single_match.rs:108:5
|
LL | / match x {
LL | | Foo::A => println!(),
@ -85,7 +85,7 @@ LL | | }
| |_____^ help: try: `if x == Foo::A { println!() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:112:5
--> tests/ui/single_match.rs:114:5
|
LL | / match x {
LL | | FOO_C => println!(),
@ -94,7 +94,7 @@ LL | | }
| |_____^ help: try: `if x == FOO_C { println!() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:117:5
--> tests/ui/single_match.rs:119:5
|
LL | / match &&x {
LL | | Foo::A => println!(),
@ -103,7 +103,7 @@ LL | | }
| |_____^ help: try: `if x == Foo::A { println!() }`
error: you seem to be trying to use `match` for an equality check. Consider using `if`
--> tests/ui/single_match.rs:123:5
--> tests/ui/single_match.rs:125:5
|
LL | / match &x {
LL | | Foo::A => println!(),
@ -112,7 +112,7 @@ LL | | }
| |_____^ help: try: `if x == &Foo::A { println!() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:140:5
--> tests/ui/single_match.rs:142:5
|
LL | / match x {
LL | | Bar::A => println!(),
@ -121,7 +121,7 @@ LL | | }
| |_____^ help: try: `if let Bar::A = x { println!() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:148:5
--> tests/ui/single_match.rs:150:5
|
LL | / match x {
LL | | None => println!(),
@ -130,7 +130,7 @@ LL | | };
| |_____^ help: try: `if let None = x { println!() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:170:5
--> tests/ui/single_match.rs:172:5
|
LL | / match x {
LL | | (Some(_), _) => {},
@ -139,7 +139,7 @@ LL | | }
| |_____^ help: try: `if let (Some(_), _) = x {}`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:176:5
--> tests/ui/single_match.rs:178:5
|
LL | / match x {
LL | | (Some(E::V), _) => todo!(),
@ -148,7 +148,7 @@ LL | | }
| |_____^ help: try: `if let (Some(E::V), _) = x { todo!() }`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:182:5
--> tests/ui/single_match.rs:184:5
|
LL | / match (Some(42), Some(E::V), Some(42)) {
LL | | (.., Some(E::V), _) => {},
@ -157,7 +157,7 @@ LL | | }
| |_____^ help: try: `if let (.., Some(E::V), _) = (Some(42), Some(E::V), Some(42)) {}`
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:254:5
--> tests/ui/single_match.rs:256:5
|
LL | / match bar {
LL | | Some(v) => unsafe {
@ -177,7 +177,7 @@ LL + } }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match.rs:262:5
--> tests/ui/single_match.rs:264:5
|
LL | / match bar {
LL | | #[rustfmt::skip]

View File

@ -1,4 +1,6 @@
//@aux-build: proc_macros.rs
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::single_match_else)]
#![allow(unused, clippy::needless_return, clippy::no_effect, clippy::uninlined_format_args)]
extern crate proc_macros;

View File

@ -1,4 +1,6 @@
//@aux-build: proc_macros.rs
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::single_match_else)]
#![allow(unused, clippy::needless_return, clippy::no_effect, clippy::uninlined_format_args)]
extern crate proc_macros;

View File

@ -1,5 +1,5 @@
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:16:13
--> tests/ui/single_match_else.rs:18:13
|
LL | let _ = match ExprNode::Butterflies {
| _____________^
@ -22,7 +22,7 @@ LL ~ };
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:81:5
--> tests/ui/single_match_else.rs:83:5
|
LL | / match Some(1) {
LL | | Some(a) => println!("${:?}", a),
@ -42,7 +42,7 @@ LL + }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:90:5
--> tests/ui/single_match_else.rs:92:5
|
LL | / match Some(1) {
LL | | Some(a) => println!("${:?}", a),
@ -62,7 +62,7 @@ LL + }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:100:5
--> tests/ui/single_match_else.rs:102:5
|
LL | / match Result::<i32, Infallible>::Ok(1) {
LL | | Ok(a) => println!("${:?}", a),
@ -82,7 +82,7 @@ LL + }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:109:5
--> tests/ui/single_match_else.rs:111:5
|
LL | / match Cow::from("moo") {
LL | | Cow::Owned(a) => println!("${:?}", a),
@ -102,7 +102,7 @@ LL + }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:119:5
--> tests/ui/single_match_else.rs:121:5
|
LL | / match bar {
LL | | Some(v) => unsafe {
@ -125,7 +125,7 @@ LL + }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:130:5
--> tests/ui/single_match_else.rs:132:5
|
LL | / match bar {
LL | | Some(v) => {
@ -149,7 +149,7 @@ LL + } }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:142:5
--> tests/ui/single_match_else.rs:144:5
|
LL | / match bar {
LL | | Some(v) => unsafe {
@ -173,7 +173,7 @@ LL + } }
|
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:154:5
--> tests/ui/single_match_else.rs:156:5
|
LL | / match bar {
LL | | #[rustfmt::skip]

View File

@ -1,4 +1,6 @@
//@aux-build:proc_macro_derive.rs
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::std_instead_of_core)]
#![allow(unused_imports)]

View File

@ -1,4 +1,6 @@
//@aux-build:proc_macro_derive.rs
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::std_instead_of_core)]
#![allow(unused_imports)]

View File

@ -1,5 +1,5 @@
error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:13:9
--> tests/ui/std_instead_of_core.rs:15:9
|
LL | use std::hash::Hasher;
| ^^^ help: consider importing the item from `core`: `core`
@ -8,49 +8,49 @@ LL | use std::hash::Hasher;
= help: to override `-D warnings` add `#[allow(clippy::std_instead_of_core)]`
error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:16:11
--> tests/ui/std_instead_of_core.rs:18:11
|
LL | use ::std::hash::Hash;
| ^^^ help: consider importing the item from `core`: `core`
error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:22:9
--> tests/ui/std_instead_of_core.rs:24:9
|
LL | use std::fmt::{Debug, Result};
| ^^^ help: consider importing the item from `core`: `core`
error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:26:15
--> tests/ui/std_instead_of_core.rs:28:15
|
LL | let ptr = std::ptr::null::<u32>();
| ^^^ help: consider importing the item from `core`: `core`
error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:28:21
--> tests/ui/std_instead_of_core.rs:30:21
|
LL | let ptr_mut = ::std::ptr::null_mut::<usize>();
| ^^^ help: consider importing the item from `core`: `core`
error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:32:16
--> tests/ui/std_instead_of_core.rs:34:16
|
LL | let cell = std::cell::Cell::new(8u32);
| ^^^ help: consider importing the item from `core`: `core`
error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:34:27
--> tests/ui/std_instead_of_core.rs:36:27
|
LL | let cell_absolute = ::std::cell::Cell::new(8u32);
| ^^^ help: consider importing the item from `core`: `core`
error: used import from `std` instead of `core`
--> tests/ui/std_instead_of_core.rs:43:9
--> tests/ui/std_instead_of_core.rs:45:9
|
LL | use std::iter::Iterator;
| ^^^ help: consider importing the item from `core`: `core`
error: used import from `std` instead of `alloc`
--> tests/ui/std_instead_of_core.rs:50:9
--> tests/ui/std_instead_of_core.rs:52:9
|
LL | use std::vec;
| ^^^ help: consider importing the item from `alloc`: `alloc`
@ -59,13 +59,13 @@ LL | use std::vec;
= help: to override `-D warnings` add `#[allow(clippy::std_instead_of_alloc)]`
error: used import from `std` instead of `alloc`
--> tests/ui/std_instead_of_core.rs:52:9
--> tests/ui/std_instead_of_core.rs:54:9
|
LL | use std::vec::Vec;
| ^^^ help: consider importing the item from `alloc`: `alloc`
error: used import from `alloc` instead of `core`
--> tests/ui/std_instead_of_core.rs:58:9
--> tests/ui/std_instead_of_core.rs:60:9
|
LL | use alloc::slice::from_ref;
| ^^^^^ help: consider importing the item from `core`: `core`

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::suspicious_operation_groupings)]
#![allow(dead_code, unused_parens, clippy::eq_op)]

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::suspicious_operation_groupings)]
#![allow(dead_code, unused_parens, clippy::eq_op)]

View File

@ -1,5 +1,5 @@
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:15:9
--> tests/ui/suspicious_operation_groupings.rs:17:9
|
LL | self.x == other.y && self.y == other.y && self.z == other.z
| ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
@ -8,151 +8,151 @@ LL | self.x == other.y && self.y == other.y && self.z == other.z
= help: to override `-D warnings` add `#[allow(clippy::suspicious_operation_groupings)]`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:28:20
--> tests/ui/suspicious_operation_groupings.rs:30:20
|
LL | s1.a < s2.a && s1.a < s2.b
| ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:76:33
--> tests/ui/suspicious_operation_groupings.rs:78:33
|
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:81:19
--> tests/ui/suspicious_operation_groupings.rs:83:19
|
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:81:19
--> tests/ui/suspicious_operation_groupings.rs:83:19
|
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:86:19
--> tests/ui/suspicious_operation_groupings.rs:88:19
|
LL | s1.a * s2.a + s2.b * s2.b + s1.c * s2.c
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:91:19
--> tests/ui/suspicious_operation_groupings.rs:93:19
|
LL | s1.a * s2.a + s1.b * s1.b + s1.c * s2.c
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:96:5
--> tests/ui/suspicious_operation_groupings.rs:98:5
|
LL | s1.a * s1.a + s1.b * s2.b + s1.c * s2.c
| ^^^^^^^^^^^ help: did you mean: `s1.a * s2.a`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:101:33
--> tests/ui/suspicious_operation_groupings.rs:103:33
|
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s1.c
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:114:20
--> tests/ui/suspicious_operation_groupings.rs:116:20
|
LL | (s1.a * s2.a + s1.b * s1.b)
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:119:34
--> tests/ui/suspicious_operation_groupings.rs:121:34
|
LL | (s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d)
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:124:38
--> tests/ui/suspicious_operation_groupings.rs:126:38
|
LL | (s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:129:39
--> tests/ui/suspicious_operation_groupings.rs:131:39
|
LL | ((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d))
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:134:42
--> tests/ui/suspicious_operation_groupings.rs:136:42
|
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:134:42
--> tests/ui/suspicious_operation_groupings.rs:136:42
|
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:139:40
--> tests/ui/suspicious_operation_groupings.rs:141:40
|
LL | (((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b)) + (s1.d * s2.d))
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:144:40
--> tests/ui/suspicious_operation_groupings.rs:146:40
|
LL | ((s1.a * s2.a) + ((s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)))
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:149:20
--> tests/ui/suspicious_operation_groupings.rs:151:20
|
LL | (s1.a * s2.a + s2.b * s2.b) / 2
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:154:35
--> tests/ui/suspicious_operation_groupings.rs:156:35
|
LL | i32::swap_bytes(s1.a * s2.a + s2.b * s2.b)
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:159:29
--> tests/ui/suspicious_operation_groupings.rs:161:29
|
LL | s1.a > 0 && s1.b > 0 && s1.d == s2.c && s1.d == s2.d
| ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:164:17
--> tests/ui/suspicious_operation_groupings.rs:166:17
|
LL | s1.a > 0 && s1.d == s2.c && s1.b > 0 && s1.d == s2.d
| ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:173:77
--> tests/ui/suspicious_operation_groupings.rs:175:77
|
LL | (n1.inner.0).0 == (n2.inner.0).0 && (n1.inner.1).0 == (n2.inner.1).0 && (n1.inner.2).0 == (n2.inner.1).0
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `(n1.inner.2).0 == (n2.inner.2).0`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:187:25
--> tests/ui/suspicious_operation_groupings.rs:189:25
|
LL | s1.a <= s2.a && s1.a <= s2.b
| ^^^^^^^^^^^^ help: did you mean: `s1.b <= s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:193:23
--> tests/ui/suspicious_operation_groupings.rs:195:23
|
LL | if s1.a < s2.a && s1.a < s2.b {
| ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:200:48
--> tests/ui/suspicious_operation_groupings.rs:202:48
|
LL | -(-(-s1.a * -s2.a) + (-(-s1.b * -s2.b) + -(-s1.c * -s2.b) + -(-s1.d * -s2.d)))
| ^^^^^^^^^^^^^ help: did you mean: `-s1.c * -s2.c`
error: this sequence of operators looks suspiciously like a bug
--> tests/ui/suspicious_operation_groupings.rs:205:27
--> tests/ui/suspicious_operation_groupings.rs:207:27
|
LL | -(if -s1.a < -s2.a && -s1.a < -s2.b { s1.c } else { s2.a })
| ^^^^^^^^^^^^^ help: did you mean: `-s1.b < -s2.b`

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#![warn(clippy::all)]
#![allow(unused, clippy::needless_pass_by_value, clippy::vec_box, clippy::useless_vec)]
#![feature(associated_type_defaults)]

View File

@ -1,5 +1,5 @@
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:7:12
--> tests/ui/type_complexity.rs:9:12
|
LL | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -8,85 +8,85 @@ LL | const CST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
= help: to override `-D warnings` add `#[allow(clippy::type_complexity)]`
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:10:12
--> tests/ui/type_complexity.rs:12:12
|
LL | static ST: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:14:8
--> tests/ui/type_complexity.rs:16:8
|
LL | f: Vec<Vec<Box<(u32, u32, u32, u32)>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:18:11
--> tests/ui/type_complexity.rs:20:11
|
LL | struct Ts(Vec<Vec<Box<(u32, u32, u32, u32)>>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:22:11
--> tests/ui/type_complexity.rs:24:11
|
LL | Tuple(Vec<Vec<Box<(u32, u32, u32, u32)>>>),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:24:17
--> tests/ui/type_complexity.rs:26:17
|
LL | Struct { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:29:14
--> tests/ui/type_complexity.rs:31:14
|
LL | const A: (u32, (u32, (u32, (u32, u32)))) = (0, (0, (0, (0, 0))));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:31:30
--> tests/ui/type_complexity.rs:33:30
|
LL | fn impl_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:36:14
--> tests/ui/type_complexity.rs:38:14
|
LL | const A: Vec<Vec<Box<(u32, u32, u32, u32)>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:38:14
--> tests/ui/type_complexity.rs:40:14
|
LL | type B = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:40:25
--> tests/ui/type_complexity.rs:42:25
|
LL | fn method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:42:29
--> tests/ui/type_complexity.rs:44:29
|
LL | fn def_method(&self, p: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:55:15
--> tests/ui/type_complexity.rs:57:15
|
LL | fn test1() -> Vec<Vec<Box<(u32, u32, u32, u32)>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:60:14
--> tests/ui/type_complexity.rs:62:14
|
LL | fn test2(_x: Vec<Vec<Box<(u32, u32, u32, u32)>>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: very complex type used. Consider factoring parts into `type` definitions
--> tests/ui/type_complexity.rs:64:13
--> tests/ui/type_complexity.rs:66:13
|
LL | let _y: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,3 +1,5 @@
//@compile-flags: -Zdeduplicate-diagnostics=yes
#[clippy::unknown]
//~^ ERROR: usage of unknown attribute
#[clippy::cognitive_complexity = "1"]

View File

@ -1,5 +1,5 @@
error: usage of unknown attribute
--> tests/ui/unknown_attribute.rs:1:11
--> tests/ui/unknown_attribute.rs:3:11
|
LL | #[clippy::unknown]
| ^^^^^^^