mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-12 20:16:49 +00:00
Don't abort compilation after giving a lint error
The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors.
This commit is contained in:
parent
e674d0a599
commit
ac9dd36856
@ -1,3 +1,4 @@
|
||||
#![allow(clippy::excessive_precision)]
|
||||
#[deny(clippy::unreadable_literal)]
|
||||
|
||||
fn allow_inconsistent_digit_grouping() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: digits grouped inconsistently by underscores
|
||||
--> $DIR/test.rs:18:18
|
||||
--> $DIR/test.rs:19:18
|
||||
|
|
||||
LL | let _fail1 = 100_200_300.123456789;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789`
|
||||
|
@ -52,12 +52,14 @@ macro_rules! m_mut {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct S;
|
||||
impl S {
|
||||
pub fn f(&self) -> &Self {
|
||||
m!(self)
|
||||
}
|
||||
pub fn f_mut(&self) -> &Self {
|
||||
#[allow(unused_mut)] // mut will be unused, once the macro is fixed
|
||||
pub fn f_mut(mut self) -> Self {
|
||||
m_mut!(self)
|
||||
}
|
||||
}
|
||||
|
@ -52,12 +52,14 @@ macro_rules! m_mut {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct S;
|
||||
impl S {
|
||||
pub fn f(&self) -> &Self {
|
||||
m!(self)
|
||||
}
|
||||
pub fn f_mut(&self) -> &Self {
|
||||
#[allow(unused_mut)] // mut will be unused, once the macro is fixed
|
||||
pub fn f_mut(mut self) -> Self {
|
||||
m_mut!(self)
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[warn(clippy::double_neg)]
|
||||
#[allow(clippy::no_effect)]
|
||||
fn main() {
|
||||
let x = 1;
|
||||
-x;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op
|
||||
--> $DIR/double_neg.rs:6:5
|
||||
--> $DIR/double_neg.rs:7:5
|
||||
|
|
||||
LL | --x;
|
||||
| ^^^
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![warn(clippy::fn_params_excessive_bools)]
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
extern "C" {
|
||||
fn f(_: bool, _: bool, _: bool, _: bool);
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:17:1
|
||||
--> $DIR/fn_params_excessive_bools.rs:18:1
|
||||
|
|
||||
LL | fn g(_: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -8,7 +8,7 @@ LL | fn g(_: bool, _: bool, _: bool, _: bool) {}
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:20:1
|
||||
--> $DIR/fn_params_excessive_bools.rs:21:1
|
||||
|
|
||||
LL | fn t(_: S, _: S, _: Box<S>, _: Vec<u32>, _: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -16,7 +16,7 @@ LL | fn t(_: S, _: S, _: Box<S>, _: Vec<u32>, _: bool, _: bool, _: bool, _: bool
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:24:5
|
||||
--> $DIR/fn_params_excessive_bools.rs:25:5
|
||||
|
|
||||
LL | fn f(_: bool, _: bool, _: bool, _: bool);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -24,7 +24,7 @@ LL | fn f(_: bool, _: bool, _: bool, _: bool);
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:29:5
|
||||
--> $DIR/fn_params_excessive_bools.rs:30:5
|
||||
|
|
||||
LL | fn f(&self, _: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -32,7 +32,7 @@ LL | fn f(&self, _: bool, _: bool, _: bool, _: bool) {}
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:41:5
|
||||
--> $DIR/fn_params_excessive_bools.rs:42:5
|
||||
|
|
||||
LL | / fn n(_: bool, _: u32, _: bool, _: Box<u32>, _: bool, _: bool) {
|
||||
LL | | fn nn(_: bool, _: bool, _: bool, _: bool) {}
|
||||
@ -42,7 +42,7 @@ LL | | }
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:42:9
|
||||
--> $DIR/fn_params_excessive_bools.rs:43:9
|
||||
|
|
||||
LL | fn nn(_: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -3,6 +3,7 @@
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
#![allow(clippy::deref_addrof)]
|
||||
#![allow(clippy::nonminimal_bool)]
|
||||
|
||||
fn foo() -> bool {
|
||||
true
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this looks like you are trying to use `.. -= ..`, but you really are doing `.. = (- ..)`
|
||||
--> $DIR/formatting.rs:15:6
|
||||
--> $DIR/formatting.rs:16:6
|
||||
|
|
||||
LL | a =- 35;
|
||||
| ^^^^
|
||||
@ -8,7 +8,7 @@ LL | a =- 35;
|
||||
= note: to remove this lint, use either `-=` or `= -`
|
||||
|
||||
error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)`
|
||||
--> $DIR/formatting.rs:16:6
|
||||
--> $DIR/formatting.rs:17:6
|
||||
|
|
||||
LL | a =* &191;
|
||||
| ^^^^
|
||||
@ -16,7 +16,7 @@ LL | a =* &191;
|
||||
= note: to remove this lint, use either `*=` or `= *`
|
||||
|
||||
error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)`
|
||||
--> $DIR/formatting.rs:19:6
|
||||
--> $DIR/formatting.rs:20:6
|
||||
|
|
||||
LL | b =! false;
|
||||
| ^^^^
|
||||
@ -24,7 +24,7 @@ LL | b =! false;
|
||||
= note: to remove this lint, use either `!=` or `= !`
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:28:19
|
||||
--> $DIR/formatting.rs:29:19
|
||||
|
|
||||
LL | -1, -2, -3 // <= no comma here
|
||||
| ^
|
||||
@ -33,7 +33,7 @@ LL | -1, -2, -3 // <= no comma here
|
||||
= note: to remove this lint, add a comma or write the expr in a single line
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:32:19
|
||||
--> $DIR/formatting.rs:33:19
|
||||
|
|
||||
LL | -1, -2, -3 // <= no comma here
|
||||
| ^
|
||||
@ -41,7 +41,7 @@ LL | -1, -2, -3 // <= no comma here
|
||||
= note: to remove this lint, add a comma or write the expr in a single line
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:69:11
|
||||
--> $DIR/formatting.rs:70:11
|
||||
|
|
||||
LL | -1
|
||||
| ^
|
||||
|
@ -4,7 +4,7 @@
|
||||
#![warn(clippy::zero_prefixed_literal)]
|
||||
#![warn(clippy::unseparated_literal_suffix)]
|
||||
#![warn(clippy::separated_literal_suffix)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(dead_code, overflowing_literals)]
|
||||
|
||||
fn main() {
|
||||
let ok1 = 0xABCD;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![allow(clippy::too_many_arguments, clippy::diverging_sub_expression)]
|
||||
#![warn(clippy::many_single_char_names)]
|
||||
|
||||
fn bla() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: 5 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:4:9
|
||||
--> $DIR/many_single_char_names.rs:5:9
|
||||
|
|
||||
LL | let a: i32;
|
||||
| ^
|
||||
@ -12,7 +12,7 @@ LL | let e: i32;
|
||||
= note: `-D clippy::many-single-char-names` implied by `-D warnings`
|
||||
|
||||
error: 6 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:4:9
|
||||
--> $DIR/many_single_char_names.rs:5:9
|
||||
|
|
||||
LL | let a: i32;
|
||||
| ^
|
||||
@ -25,7 +25,7 @@ LL | let f: i32;
|
||||
| ^
|
||||
|
||||
error: 5 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:4:9
|
||||
--> $DIR/many_single_char_names.rs:5:9
|
||||
|
|
||||
LL | let a: i32;
|
||||
| ^
|
||||
@ -36,13 +36,13 @@ LL | e => panic!(),
|
||||
| ^
|
||||
|
||||
error: 8 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:29:13
|
||||
--> $DIR/many_single_char_names.rs:30: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
|
||||
--> $DIR/many_single_char_names.rs:32:10
|
||||
--> $DIR/many_single_char_names.rs:33:10
|
||||
|
|
||||
LL | let (a, b, c, d, e, f, g, h): (bool, bool, bool, bool, bool, bool, bool, bool) = unimplemented!();
|
||||
| ^ ^ ^ ^ ^ ^ ^ ^
|
||||
|
@ -3,6 +3,7 @@
|
||||
#![allow(
|
||||
dead_code,
|
||||
unused_variables,
|
||||
overflowing_literals,
|
||||
clippy::excessive_precision,
|
||||
clippy::inconsistent_digit_grouping
|
||||
)]
|
||||
@ -21,7 +22,6 @@ fn main() {
|
||||
let fail25 = 1E2_f32;
|
||||
let fail26 = 43E7_f64;
|
||||
let fail27 = 243E17_f32;
|
||||
#[allow(overflowing_literals)]
|
||||
let fail28 = 241_251_235E723_f64;
|
||||
let ok29 = 42279.911_32;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#![allow(
|
||||
dead_code,
|
||||
unused_variables,
|
||||
overflowing_literals,
|
||||
clippy::excessive_precision,
|
||||
clippy::inconsistent_digit_grouping
|
||||
)]
|
||||
@ -21,7 +22,6 @@ fn main() {
|
||||
let fail25 = 1E2_32;
|
||||
let fail26 = 43E7_64;
|
||||
let fail27 = 243E17_32;
|
||||
#[allow(overflowing_literals)]
|
||||
let fail28 = 241251235E723_64;
|
||||
let ok29 = 42279.911_32;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:11:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:12:18
|
||||
|
|
||||
LL | let fail14 = 2_32;
|
||||
| ^^^^ help: did you mean to write: `2_i32`
|
||||
@ -7,49 +7,49 @@ LL | let fail14 = 2_32;
|
||||
= note: `#[deny(clippy::mistyped_literal_suffixes)]` on by default
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:12:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:13:18
|
||||
|
|
||||
LL | let fail15 = 4_64;
|
||||
| ^^^^ help: did you mean to write: `4_i64`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:13:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:14:18
|
||||
|
|
||||
LL | let fail16 = 7_8; //
|
||||
| ^^^ help: did you mean to write: `7_i8`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:14:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:15:18
|
||||
|
|
||||
LL | let fail17 = 23_16; //
|
||||
| ^^^^^ help: did you mean to write: `23_i16`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:17:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:18:18
|
||||
|
|
||||
LL | let fail20 = 2__8; //
|
||||
| ^^^^ help: did you mean to write: `2_i8`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:18:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:19:18
|
||||
|
|
||||
LL | let fail21 = 4___16; //
|
||||
| ^^^^^^ help: did you mean to write: `4_i16`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:21:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:22:18
|
||||
|
|
||||
LL | let fail25 = 1E2_32;
|
||||
| ^^^^^^ help: did you mean to write: `1E2_f32`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:22:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:23:18
|
||||
|
|
||||
LL | let fail26 = 43E7_64;
|
||||
| ^^^^^^^ help: did you mean to write: `43E7_f64`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:23:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:24:18
|
||||
|
|
||||
LL | let fail27 = 243E17_32;
|
||||
| ^^^^^^^^^ help: did you mean to write: `243E17_f32`
|
||||
|
@ -38,6 +38,7 @@ mod issue_6089 {
|
||||
// fn call_with_mut_self<'life0>(self: &'life0 mut Self) {}
|
||||
#[rename_my_lifetimes]
|
||||
impl T2 for S2 {
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
fn call_with_mut_self(self: &mut Self) {}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: the type of the `self` parameter does not need to be arbitrary
|
||||
--> $DIR/needless_arbitrary_self_type_unfixable.rs:41:31
|
||||
--> $DIR/needless_arbitrary_self_type_unfixable.rs:42:31
|
||||
|
|
||||
LL | fn call_with_mut_self(self: &mut Self) {}
|
||||
| ^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'_ mut self`
|
||||
|
@ -12,6 +12,7 @@ macro_rules! nonzero {
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(clippy::nonminimal_bool)]
|
||||
fn main() {
|
||||
let mut i = 1;
|
||||
while i < 10 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this `else` block is redundant
|
||||
--> $DIR/needless_continue.rs:28:16
|
||||
--> $DIR/needless_continue.rs:29: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:43:9
|
||||
--> $DIR/needless_continue.rs:44: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:56:9
|
||||
--> $DIR/needless_continue.rs:57: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:63:9
|
||||
--> $DIR/needless_continue.rs:64: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:70:9
|
||||
--> $DIR/needless_continue.rs:71: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:78:9
|
||||
--> $DIR/needless_continue.rs:79: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:128:24
|
||||
--> $DIR/needless_continue.rs:129: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:134:17
|
||||
--> $DIR/needless_continue.rs:135:17
|
||||
|
|
||||
LL | / if condition() {
|
||||
LL | | continue; // should lint here
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(clippy::all)]
|
||||
#![allow(unused, clippy::println_empty_string)]
|
||||
#![allow(unused, clippy::println_empty_string, non_snake_case)]
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
enum MaybeInst {
|
||||
@ -14,6 +14,7 @@ struct InstSplit {
|
||||
|
||||
impl MaybeInst {
|
||||
fn fill(&mut self) {
|
||||
#[allow(non_fmt_panics)]
|
||||
let filled = match *self {
|
||||
MaybeInst::Split1(goto1) => panic!("1"),
|
||||
MaybeInst::Split2(goto2) => panic!("2"),
|
||||
@ -36,6 +37,7 @@ fn issue2927() {
|
||||
}
|
||||
|
||||
fn issue3078() {
|
||||
#[allow(clippy::single_match)]
|
||||
match "a" {
|
||||
stringify!(a) => {},
|
||||
_ => {},
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:27:9
|
||||
--> $DIR/non_expressive_names.rs:28:9
|
||||
|
|
||||
LL | let _1 = 1; //~ERROR Consider a more descriptive name
|
||||
| ^^
|
||||
@ -7,31 +7,31 @@ LL | let _1 = 1; //~ERROR Consider a more descriptive name
|
||||
= note: `-D clippy::just-underscores-and-digits` implied by `-D warnings`
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:28:9
|
||||
--> $DIR/non_expressive_names.rs:29:9
|
||||
|
|
||||
LL | let ____1 = 1; //~ERROR Consider a more descriptive name
|
||||
| ^^^^^
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:29:9
|
||||
--> $DIR/non_expressive_names.rs:30:9
|
||||
|
|
||||
LL | let __1___2 = 12; //~ERROR Consider a more descriptive name
|
||||
| ^^^^^^^
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:49:13
|
||||
--> $DIR/non_expressive_names.rs:51:13
|
||||
|
|
||||
LL | let _1 = 1;
|
||||
| ^^
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:50:13
|
||||
--> $DIR/non_expressive_names.rs:52:13
|
||||
|
|
||||
LL | let ____1 = 1;
|
||||
| ^^^^^
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:51:13
|
||||
--> $DIR/non_expressive_names.rs:53:13
|
||||
|
|
||||
LL | let __1___2 = 12;
|
||||
| ^^^^^^^
|
||||
|
@ -15,5 +15,6 @@ fn main() {
|
||||
#[allow(clippy::needless_return)]
|
||||
(|| return 2)();
|
||||
(|| -> Option<i32> { None? })();
|
||||
#[allow(clippy::try_err)]
|
||||
(|| -> Result<i32, i32> { Err(2)? })();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(clippy::redundant_else)]
|
||||
#![allow(clippy::needless_return)]
|
||||
#![allow(clippy::needless_return, clippy::if_same_then_else)]
|
||||
|
||||
fn main() {
|
||||
loop {
|
||||
@ -105,7 +105,7 @@ fn main() {
|
||||
1
|
||||
};
|
||||
// assign
|
||||
let a;
|
||||
let mut a;
|
||||
a = if foo() {
|
||||
return;
|
||||
} else {
|
||||
|
@ -1,5 +1,10 @@
|
||||
#![warn(clippy::similar_names)]
|
||||
#![allow(unused, clippy::println_empty_string)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::println_empty_string,
|
||||
clippy::empty_loop,
|
||||
clippy::diverging_sub_expression
|
||||
)]
|
||||
|
||||
struct Foo {
|
||||
apple: i32,
|
||||
|
@ -1,84 +1,84 @@
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:15:9
|
||||
--> $DIR/similar_names.rs:20:9
|
||||
|
|
||||
LL | let bpple: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D clippy::similar-names` implied by `-D warnings`
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:13:9
|
||||
--> $DIR/similar_names.rs:18:9
|
||||
|
|
||||
LL | let apple: i32;
|
||||
| ^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:17:9
|
||||
--> $DIR/similar_names.rs:22:9
|
||||
|
|
||||
LL | let cpple: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:13:9
|
||||
--> $DIR/similar_names.rs:18:9
|
||||
|
|
||||
LL | let apple: i32;
|
||||
| ^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:41:9
|
||||
--> $DIR/similar_names.rs:46:9
|
||||
|
|
||||
LL | let bluby: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:40:9
|
||||
--> $DIR/similar_names.rs:45:9
|
||||
|
|
||||
LL | let blubx: i32;
|
||||
| ^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:45:9
|
||||
--> $DIR/similar_names.rs:50:9
|
||||
|
|
||||
LL | let coke: i32;
|
||||
| ^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:43:9
|
||||
--> $DIR/similar_names.rs:48:9
|
||||
|
|
||||
LL | let cake: i32;
|
||||
| ^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:63:9
|
||||
--> $DIR/similar_names.rs:68:9
|
||||
|
|
||||
LL | let xyzeabc: i32;
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:61:9
|
||||
--> $DIR/similar_names.rs:66:9
|
||||
|
|
||||
LL | let xyz1abc: i32;
|
||||
| ^^^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:67:9
|
||||
--> $DIR/similar_names.rs:72:9
|
||||
|
|
||||
LL | let parsee: i32;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:65:9
|
||||
--> $DIR/similar_names.rs:70:9
|
||||
|
|
||||
LL | let parser: i32;
|
||||
| ^^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:88:16
|
||||
--> $DIR/similar_names.rs:93:16
|
||||
|
|
||||
LL | bpple: sprang,
|
||||
| ^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:87:16
|
||||
--> $DIR/similar_names.rs:92:16
|
||||
|
|
||||
LL | apple: spring,
|
||||
| ^^^^^^
|
||||
|
@ -1,6 +1,7 @@
|
||||
// aux-build:proc_macro_suspicious_else_formatting.rs
|
||||
|
||||
#![warn(clippy::suspicious_else_formatting)]
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
|
||||
extern crate proc_macro_suspicious_else_formatting;
|
||||
use proc_macro_suspicious_else_formatting::DeriveBadSpan;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this looks like an `else {..}` but the `else` is missing
|
||||
--> $DIR/suspicious_else_formatting.rs:16:6
|
||||
--> $DIR/suspicious_else_formatting.rs:17:6
|
||||
|
|
||||
LL | } {
|
||||
| ^
|
||||
@ -8,7 +8,7 @@ LL | } {
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the next block
|
||||
|
||||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/suspicious_else_formatting.rs:20:6
|
||||
--> $DIR/suspicious_else_formatting.rs:21:6
|
||||
|
|
||||
LL | } if foo() {
|
||||
| ^
|
||||
@ -16,7 +16,7 @@ LL | } if foo() {
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/suspicious_else_formatting.rs:27:10
|
||||
--> $DIR/suspicious_else_formatting.rs:28:10
|
||||
|
|
||||
LL | } if foo() {
|
||||
| ^
|
||||
@ -24,7 +24,7 @@ LL | } if foo() {
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/suspicious_else_formatting.rs:35:10
|
||||
--> $DIR/suspicious_else_formatting.rs:36:10
|
||||
|
|
||||
LL | } if foo() {
|
||||
| ^
|
||||
@ -32,7 +32,7 @@ LL | } if foo() {
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this is an `else {..}` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:44:6
|
||||
--> $DIR/suspicious_else_formatting.rs:45:6
|
||||
|
|
||||
LL | } else
|
||||
| ______^
|
||||
@ -42,7 +42,7 @@ LL | | {
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}`
|
||||
|
||||
error: this is an `else if` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:56:6
|
||||
--> $DIR/suspicious_else_formatting.rs:57:6
|
||||
|
|
||||
LL | } else
|
||||
| ______^
|
||||
@ -52,7 +52,7 @@ LL | | if foo() { // the span of the above error should continue here
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
|
||||
|
||||
error: this is an `else if` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:61:6
|
||||
--> $DIR/suspicious_else_formatting.rs:62:6
|
||||
|
|
||||
LL | }
|
||||
| ______^
|
||||
@ -63,7 +63,7 @@ LL | | if foo() { // the span of the above error should continue here
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
|
||||
|
||||
error: this is an `else {..}` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:88:6
|
||||
--> $DIR/suspicious_else_formatting.rs:89:6
|
||||
|
|
||||
LL | }
|
||||
| ______^
|
||||
@ -75,7 +75,7 @@ LL | | {
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}`
|
||||
|
||||
error: this is an `else {..}` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:96:6
|
||||
--> $DIR/suspicious_else_formatting.rs:97:6
|
||||
|
|
||||
LL | }
|
||||
| ______^
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![warn(clippy::suspicious_operation_groupings)]
|
||||
#![allow(clippy::eq_op)]
|
||||
|
||||
struct Vec3 {
|
||||
x: f64,
|
||||
@ -187,7 +188,7 @@ fn inside_fn_with_similar_expression(s1: &S, s2: &S, strict: bool) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn inside_an_if_statement(s1: &S, s2: &S) {
|
||||
fn inside_an_if_statement(s1: &mut S, s2: &S) {
|
||||
// There's no `s1.b`
|
||||
if s1.a < s2.a && s1.a < s2.b {
|
||||
s1.c = s2.c;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:14:9
|
||||
--> $DIR/suspicious_operation_groupings.rs:15:9
|
||||
|
|
||||
LL | self.x == other.y && self.y == other.y && self.z == other.z
|
||||
| ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
|
||||
@ -7,151 +7,151 @@ LL | self.x == other.y && self.y == other.y && self.z == other.z
|
||||
= note: `-D clippy::suspicious-operation-groupings` implied by `-D warnings`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:27:20
|
||||
--> $DIR/suspicious_operation_groupings.rs:28: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:75:33
|
||||
--> $DIR/suspicious_operation_groupings.rs:76: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:80:19
|
||||
--> $DIR/suspicious_operation_groupings.rs:81: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:80:19
|
||||
--> $DIR/suspicious_operation_groupings.rs:81: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:85:19
|
||||
--> $DIR/suspicious_operation_groupings.rs:86: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:90:19
|
||||
--> $DIR/suspicious_operation_groupings.rs:91: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:95:5
|
||||
--> $DIR/suspicious_operation_groupings.rs:96: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:100:33
|
||||
--> $DIR/suspicious_operation_groupings.rs:101: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:113:20
|
||||
--> $DIR/suspicious_operation_groupings.rs:114: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:118:34
|
||||
--> $DIR/suspicious_operation_groupings.rs:119: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:123:38
|
||||
--> $DIR/suspicious_operation_groupings.rs:124: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:128:39
|
||||
--> $DIR/suspicious_operation_groupings.rs:129: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:133:42
|
||||
--> $DIR/suspicious_operation_groupings.rs:134: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:133:42
|
||||
--> $DIR/suspicious_operation_groupings.rs:134: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:138:40
|
||||
--> $DIR/suspicious_operation_groupings.rs:139: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:143:40
|
||||
--> $DIR/suspicious_operation_groupings.rs:144: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:148:20
|
||||
--> $DIR/suspicious_operation_groupings.rs:149: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:153:35
|
||||
--> $DIR/suspicious_operation_groupings.rs:154: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:158:29
|
||||
--> $DIR/suspicious_operation_groupings.rs:159: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:163:17
|
||||
--> $DIR/suspicious_operation_groupings.rs:164: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:172:77
|
||||
--> $DIR/suspicious_operation_groupings.rs:173: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:186:25
|
||||
--> $DIR/suspicious_operation_groupings.rs:187: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:192:23
|
||||
--> $DIR/suspicious_operation_groupings.rs:193: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:199:48
|
||||
--> $DIR/suspicious_operation_groupings.rs:200: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
|
||||
--> $DIR/suspicious_operation_groupings.rs:204:27
|
||||
--> $DIR/suspicious_operation_groupings.rs:205:27
|
||||
|
|
||||
LL | -(if -s1.a < -s2.a && -s1.a < -s2.b { s1.c } else { s2.a })
|
||||
| ^^^^^^^^^^^^^ help: did you mean: `-s1.b < -s2.b`
|
||||
|
Loading…
Reference in New Issue
Block a user