1
Fork 0

Downgrade many_single_char_names to pedantic

This commit is contained in:
David Tolnay 2021-09-14 09:48:30 -07:00
parent 746a0051c3
commit c2783c1dcb
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
40 changed files with 124 additions and 139 deletions

View file

@ -1137,6 +1137,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(needless_continue::NEEDLESS_CONTINUE), LintId::of(needless_continue::NEEDLESS_CONTINUE),
LintId::of(needless_for_each::NEEDLESS_FOR_EACH), LintId::of(needless_for_each::NEEDLESS_FOR_EACH),
LintId::of(needless_pass_by_value::NEEDLESS_PASS_BY_VALUE), LintId::of(needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES),
LintId::of(non_expressive_names::SIMILAR_NAMES), LintId::of(non_expressive_names::SIMILAR_NAMES),
LintId::of(pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE), LintId::of(pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE),
LintId::of(pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF), LintId::of(pass_by_ref_or_value::TRIVIALLY_COPY_PASS_BY_REF),
@ -1393,7 +1394,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST), LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST), LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS), LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES),
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS), LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS), LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS),
LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP), LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP),
@ -1567,7 +1567,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST), LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST), LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS), LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES),
LintId::of(ptr::CMP_NULL), LintId::of(ptr::CMP_NULL),
LintId::of(ptr::PTR_ARG), LintId::of(ptr::PTR_ARG),
LintId::of(ptr_eq::PTR_EQ), LintId::of(ptr_eq::PTR_EQ),

View file

@ -43,7 +43,7 @@ declare_clippy_lint! {
/// let (a, b, c, d, e, f, g) = (...); /// let (a, b, c, d, e, f, g) = (...);
/// ``` /// ```
pub MANY_SINGLE_CHAR_NAMES, pub MANY_SINGLE_CHAR_NAMES,
style, pedantic,
"too many single character bindings" "too many single character bindings"
} }

View file

@ -540,7 +540,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
std::mem::discriminant(&b.rules).hash(&mut self.s); std::mem::discriminant(&b.rules).hash(&mut self.s);
} }
#[allow(clippy::many_single_char_names, clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
pub fn hash_expr(&mut self, e: &Expr<'_>) { pub fn hash_expr(&mut self, e: &Expr<'_>) {
let simple_const = self let simple_const = self
.maybe_typeck_results .maybe_typeck_results

View file

@ -2,7 +2,6 @@
// normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)" // normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)"
#![deny(clippy::trivially_copy_pass_by_ref)] #![deny(clippy::trivially_copy_pass_by_ref)]
#![allow(clippy::many_single_char_names)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
struct Foo(u8); struct Foo(u8);

View file

@ -1,5 +1,5 @@
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/test.rs:15:11 --> $DIR/test.rs:14:11
| |
LL | fn bad(x: &u16, y: &Foo) {} LL | fn bad(x: &u16, y: &Foo) {}
| ^^^^ help: consider passing by value instead: `u16` | ^^^^ help: consider passing by value instead: `u16`
@ -11,7 +11,7 @@ LL | #![deny(clippy::trivially_copy_pass_by_ref)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/test.rs:15:20 --> $DIR/test.rs:14:20
| |
LL | fn bad(x: &u16, y: &Foo) {} LL | fn bad(x: &u16, y: &Foo) {}
| ^^^^ help: consider passing by value instead: `Foo` | ^^^^ help: consider passing by value instead: `Foo`

View file

@ -9,7 +9,7 @@ fn get_reference(n: &usize) -> &usize {
n n
} }
#[allow(clippy::many_single_char_names, clippy::double_parens)] #[allow(clippy::double_parens)]
#[allow(unused_variables, unused_parens)] #[allow(unused_variables, unused_parens)]
fn main() { fn main() {
let a = 10; let a = 10;

View file

@ -9,7 +9,7 @@ fn get_reference(n: &usize) -> &usize {
n n
} }
#[allow(clippy::many_single_char_names, clippy::double_parens)] #[allow(clippy::double_parens)]
#[allow(unused_variables, unused_parens)] #[allow(unused_variables, unused_parens)]
fn main() { fn main() {
let a = 10; let a = 10;

View file

@ -2,7 +2,7 @@
#[rustfmt::skip] #[rustfmt::skip]
#[warn(clippy::eq_op)] #[warn(clippy::eq_op)]
#[allow(clippy::identity_op, clippy::double_parens, clippy::many_single_char_names)] #[allow(clippy::identity_op, clippy::double_parens)]
#[allow(clippy::no_effect, unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)] #[allow(clippy::no_effect, unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)]
#[allow(clippy::nonminimal_bool)] #[allow(clippy::nonminimal_bool)]
#[allow(unused)] #[allow(unused)]

View file

@ -4,7 +4,6 @@
unused, unused,
clippy::no_effect, clippy::no_effect,
clippy::redundant_closure_call, clippy::redundant_closure_call,
clippy::many_single_char_names,
clippy::needless_pass_by_value, clippy::needless_pass_by_value,
clippy::option_map_unit_fn clippy::option_map_unit_fn
)] )]

View file

@ -4,7 +4,6 @@
unused, unused,
clippy::no_effect, clippy::no_effect,
clippy::redundant_closure_call, clippy::redundant_closure_call,
clippy::many_single_char_names,
clippy::needless_pass_by_value, clippy::needless_pass_by_value,
clippy::option_map_unit_fn clippy::option_map_unit_fn
)] )]

View file

@ -1,5 +1,5 @@
error: redundant closure error: redundant closure
--> $DIR/eta.rs:32:27 --> $DIR/eta.rs:31:27
| |
LL | let a = Some(1u8).map(|a| foo(a)); LL | let a = Some(1u8).map(|a| foo(a));
| ^^^^^^^^^^ help: replace the closure with the function itself: `foo` | ^^^^^^^^^^ help: replace the closure with the function itself: `foo`
@ -7,19 +7,19 @@ LL | let a = Some(1u8).map(|a| foo(a));
= note: `-D clippy::redundant-closure` implied by `-D warnings` = note: `-D clippy::redundant-closure` implied by `-D warnings`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:36:40 --> $DIR/eta.rs:35:40
| |
LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec! LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
| ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new` | ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:37:35 --> $DIR/eta.rs:36:35
| |
LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted? LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted?
| ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2` | ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
--> $DIR/eta.rs:38:21 --> $DIR/eta.rs:37:21
| |
LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
| ^^^ help: change this to: `&2` | ^^^ help: change this to: `&2`
@ -27,25 +27,25 @@ LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
= note: `-D clippy::needless-borrow` implied by `-D warnings` = note: `-D clippy::needless-borrow` implied by `-D warnings`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:38:26 --> $DIR/eta.rs:37:26
| |
LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
| ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below` | ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:44:27 --> $DIR/eta.rs:43:27
| |
LL | let e = Some(1u8).map(|a| divergent(a)); LL | let e = Some(1u8).map(|a| divergent(a));
| ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `divergent` | ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `divergent`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:45:27 --> $DIR/eta.rs:44:27
| |
LL | let e = Some(1u8).map(|a| generic(a)); LL | let e = Some(1u8).map(|a| generic(a));
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic` | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:91:51 --> $DIR/eta.rs:90:51
| |
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo()); LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
| ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo` | ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
@ -53,79 +53,79 @@ LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
= note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings` = note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:92:51 --> $DIR/eta.rs:91:51
| |
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo()); LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo` | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:94:42 --> $DIR/eta.rs:93:42
| |
LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear()); LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
| ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear` | ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:98:29 --> $DIR/eta.rs:97:29
| |
LL | let e = Some("str").map(|s| s.to_string()); LL | let e = Some("str").map(|s| s.to_string());
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string` | ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:99:27 --> $DIR/eta.rs:98:27
| |
LL | let e = Some('a').map(|s| s.to_uppercase()); LL | let e = Some('a').map(|s| s.to_uppercase());
| ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase` | ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:101:65 --> $DIR/eta.rs:100:65
| |
LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect(); LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase` | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:164:22 --> $DIR/eta.rs:163:22
| |
LL | requires_fn_once(|| x()); LL | requires_fn_once(|| x());
| ^^^^^^ help: replace the closure with the function itself: `x` | ^^^^^^ help: replace the closure with the function itself: `x`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:171:27 --> $DIR/eta.rs:170:27
| |
LL | let a = Some(1u8).map(|a| foo_ptr(a)); LL | let a = Some(1u8).map(|a| foo_ptr(a));
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr` | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:176:27 --> $DIR/eta.rs:175:27
| |
LL | let a = Some(1u8).map(|a| closure(a)); LL | let a = Some(1u8).map(|a| closure(a));
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure` | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:208:28 --> $DIR/eta.rs:207:28
| |
LL | x.into_iter().for_each(|x| add_to_res(x)); LL | x.into_iter().for_each(|x| add_to_res(x));
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res` | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:209:28 --> $DIR/eta.rs:208:28
| |
LL | y.into_iter().for_each(|x| add_to_res(x)); LL | y.into_iter().for_each(|x| add_to_res(x));
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res` | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:210:28 --> $DIR/eta.rs:209:28
| |
LL | z.into_iter().for_each(|x| add_to_res(x)); LL | z.into_iter().for_each(|x| add_to_res(x));
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res` | ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:217:21 --> $DIR/eta.rs:216:21
| |
LL | Some(1).map(|n| closure(n)); LL | Some(1).map(|n| closure(n));
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure` | ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
error: redundant closure error: redundant closure
--> $DIR/eta.rs:236:21 --> $DIR/eta.rs:235:21
| |
LL | map_str_to_path(|s| s.as_ref()); LL | map_str_to_path(|s| s.as_ref());
| ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::convert::AsRef::as_ref` | ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::convert::AsRef::as_ref`

View file

@ -4,7 +4,6 @@
#[allow( #[allow(
unused_assignments, unused_assignments,
unused_variables, unused_variables,
clippy::many_single_char_names,
clippy::no_effect, clippy::no_effect,
dead_code, dead_code,
clippy::blacklisted_name clippy::blacklisted_name

View file

@ -1,48 +1,48 @@
error: unsequenced read of `x` error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:17:9 --> $DIR/eval_order_dependence.rs:16:9
| |
LL | } + x; LL | } + x;
| ^ | ^
| |
= note: `-D clippy::eval-order-dependence` implied by `-D warnings` = note: `-D clippy::eval-order-dependence` implied by `-D warnings`
note: whether read occurs before this write depends on evaluation order note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:15:9 --> $DIR/eval_order_dependence.rs:14:9
| |
LL | x = 1; LL | x = 1;
| ^^^^^ | ^^^^^
error: unsequenced read of `x` error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:20:5 --> $DIR/eval_order_dependence.rs:19:5
| |
LL | x += { LL | x += {
| ^ | ^
| |
note: whether read occurs before this write depends on evaluation order note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:21:9 --> $DIR/eval_order_dependence.rs:20:9
| |
LL | x = 20; LL | x = 20;
| ^^^^^^ | ^^^^^^
error: unsequenced read of `x` error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:33:12 --> $DIR/eval_order_dependence.rs:32:12
| |
LL | a: x, LL | a: x,
| ^ | ^
| |
note: whether read occurs before this write depends on evaluation order note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:35:13 --> $DIR/eval_order_dependence.rs:34:13
| |
LL | x = 6; LL | x = 6;
| ^^^^^ | ^^^^^
error: unsequenced read of `x` error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:42:9 --> $DIR/eval_order_dependence.rs:41:9
| |
LL | x += { LL | x += {
| ^ | ^
| |
note: whether read occurs before this write depends on evaluation order note: whether read occurs before this write depends on evaluation order
--> $DIR/eval_order_dependence.rs:43:13 --> $DIR/eval_order_dependence.rs:42:13
| |
LL | x = 20; LL | x = 20;
| ^^^^^^ | ^^^^^^

View file

@ -1,6 +1,6 @@
// run-rustfix // run-rustfix
#![allow(unused_variables, clippy::many_single_char_names, clippy::clone_double_ref)] #![allow(unused_variables, clippy::clone_double_ref)]
#![warn(clippy::explicit_deref_methods)] #![warn(clippy::explicit_deref_methods)]
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};

View file

@ -1,6 +1,6 @@
// run-rustfix // run-rustfix
#![allow(unused_variables, clippy::many_single_char_names, clippy::clone_double_ref)] #![allow(unused_variables, clippy::clone_double_ref)]
#![warn(clippy::explicit_deref_methods)] #![warn(clippy::explicit_deref_methods)]
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};

View file

@ -4,8 +4,7 @@
clippy::no_effect, clippy::no_effect,
clippy::op_ref, clippy::op_ref,
clippy::unnecessary_operation, clippy::unnecessary_operation,
clippy::cast_lossless, clippy::cast_lossless
clippy::many_single_char_names
)] )]
use std::ops::Add; use std::ops::Add;

View file

@ -1,5 +1,5 @@
error: strict comparison of `f32` or `f64` error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:58:5 --> $DIR/float_cmp.rs:57:5
| |
LL | ONE as f64 != 2.0; LL | ONE as f64 != 2.0;
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(ONE as f64 - 2.0).abs() > error_margin` | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(ONE as f64 - 2.0).abs() > error_margin`
@ -8,7 +8,7 @@ LL | ONE as f64 != 2.0;
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
error: strict comparison of `f32` or `f64` error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:63:5 --> $DIR/float_cmp.rs:62:5
| |
LL | x == 1.0; LL | x == 1.0;
| ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 1.0).abs() < error_margin` | ^^^^^^^^ help: consider comparing them within some margin of error: `(x - 1.0).abs() < error_margin`
@ -16,7 +16,7 @@ LL | x == 1.0;
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
error: strict comparison of `f32` or `f64` error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:66:5 --> $DIR/float_cmp.rs:65:5
| |
LL | twice(x) != twice(ONE as f64); LL | twice(x) != twice(ONE as f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(twice(x) - twice(ONE as f64)).abs() > error_margin` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(twice(x) - twice(ONE as f64)).abs() > error_margin`
@ -24,7 +24,7 @@ LL | twice(x) != twice(ONE as f64);
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
error: strict comparison of `f32` or `f64` error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:86:5 --> $DIR/float_cmp.rs:85:5
| |
LL | NON_ZERO_ARRAY[i] == NON_ZERO_ARRAY[j]; LL | NON_ZERO_ARRAY[i] == NON_ZERO_ARRAY[j];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(NON_ZERO_ARRAY[i] - NON_ZERO_ARRAY[j]).abs() < error_margin` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(NON_ZERO_ARRAY[i] - NON_ZERO_ARRAY[j]).abs() < error_margin`
@ -32,7 +32,7 @@ LL | NON_ZERO_ARRAY[i] == NON_ZERO_ARRAY[j];
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
error: strict comparison of `f32` or `f64` arrays error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:91:5 --> $DIR/float_cmp.rs:90:5
| |
LL | a1 == a2; LL | a1 == a2;
| ^^^^^^^^ | ^^^^^^^^
@ -40,7 +40,7 @@ LL | a1 == a2;
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
error: strict comparison of `f32` or `f64` error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:92:5 --> $DIR/float_cmp.rs:91:5
| |
LL | a1[0] == a2[0]; LL | a1[0] == a2[0];
| ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(a1[0] - a2[0]).abs() < error_margin` | ^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(a1[0] - a2[0]).abs() < error_margin`

View file

@ -29,7 +29,7 @@ impl Unrelated {
clippy::unnecessary_mut_passed, clippy::unnecessary_mut_passed,
clippy::similar_names clippy::similar_names
)] )]
#[allow(clippy::many_single_char_names, unused_variables)] #[allow(unused_variables)]
fn main() { fn main() {
let mut vec = vec![1, 2, 3, 4]; let mut vec = vec![1, 2, 3, 4];

View file

@ -29,7 +29,7 @@ impl Unrelated {
clippy::unnecessary_mut_passed, clippy::unnecessary_mut_passed,
clippy::similar_names clippy::similar_names
)] )]
#[allow(clippy::many_single_char_names, unused_variables)] #[allow(unused_variables)]
fn main() { fn main() {
let mut vec = vec![1, 2, 3, 4]; let mut vec = vec![1, 2, 3, 4];

View file

@ -16,7 +16,6 @@ fn foob() -> bool {
unimplemented!() unimplemented!()
} }
#[allow(clippy::many_single_char_names)]
fn immutable_condition() { fn immutable_condition() {
// Should warn when all vars mentioned are immutable // Should warn when all vars mentioned are immutable
let y = 0; let y = 0;

View file

@ -1,5 +1,5 @@
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:23:11 --> $DIR/infinite_loop.rs:22:11
| |
LL | while y < 10 { LL | while y < 10 {
| ^^^^^^ | ^^^^^^
@ -8,7 +8,7 @@ LL | while y < 10 {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:28:11 --> $DIR/infinite_loop.rs:27:11
| |
LL | while y < 10 && x < 3 { LL | while y < 10 && x < 3 {
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
@ -16,7 +16,7 @@ LL | while y < 10 && x < 3 {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:35:11 --> $DIR/infinite_loop.rs:34:11
| |
LL | while !cond { LL | while !cond {
| ^^^^^ | ^^^^^
@ -24,7 +24,7 @@ LL | while !cond {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:79:11 --> $DIR/infinite_loop.rs:78:11
| |
LL | while i < 3 { LL | while i < 3 {
| ^^^^^ | ^^^^^
@ -32,7 +32,7 @@ LL | while i < 3 {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:84:11 --> $DIR/infinite_loop.rs:83:11
| |
LL | while i < 3 && j > 0 { LL | while i < 3 && j > 0 {
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
@ -40,7 +40,7 @@ LL | while i < 3 && j > 0 {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:88:11 --> $DIR/infinite_loop.rs:87:11
| |
LL | while i < 3 { LL | while i < 3 {
| ^^^^^ | ^^^^^
@ -48,7 +48,7 @@ LL | while i < 3 {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:103:11 --> $DIR/infinite_loop.rs:102:11
| |
LL | while i < 3 { LL | while i < 3 {
| ^^^^^ | ^^^^^
@ -56,7 +56,7 @@ LL | while i < 3 {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:108:11 --> $DIR/infinite_loop.rs:107:11
| |
LL | while i < 3 { LL | while i < 3 {
| ^^^^^ | ^^^^^
@ -64,7 +64,7 @@ LL | while i < 3 {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:174:15 --> $DIR/infinite_loop.rs:173:15
| |
LL | while self.count < n { LL | while self.count < n {
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
@ -72,7 +72,7 @@ LL | while self.count < n {
= note: this may lead to an infinite or to a never running loop = note: this may lead to an infinite or to a never running loop
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:182:11 --> $DIR/infinite_loop.rs:181:11
| |
LL | while y < 10 { LL | while y < 10 {
| ^^^^^^ | ^^^^^^
@ -82,7 +82,7 @@ LL | while y < 10 {
= help: rewrite it as `if cond { loop { } }` = help: rewrite it as `if cond { loop { } }`
error: variables in the condition are not mutated in the loop body error: variables in the condition are not mutated in the loop body
--> $DIR/infinite_loop.rs:189:11 --> $DIR/infinite_loop.rs:188:11
| |
LL | while y < 10 { LL | while y < 10 {
| ^^^^^^ | ^^^^^^

View file

@ -1,6 +1,5 @@
#![warn(clippy::inherent_to_string)] #![warn(clippy::inherent_to_string)]
#![deny(clippy::inherent_to_string_shadow_display)] #![deny(clippy::inherent_to_string_shadow_display)]
#![allow(clippy::many_single_char_names)]
use std::fmt; use std::fmt;

View file

@ -1,5 +1,5 @@
error: implementation of inherent method `to_string(&self) -> String` for type `A` error: implementation of inherent method `to_string(&self) -> String` for type `A`
--> $DIR/inherent_to_string.rs:21:5 --> $DIR/inherent_to_string.rs:20:5
| |
LL | / fn to_string(&self) -> String { LL | / fn to_string(&self) -> String {
LL | | "A.to_string()".to_string() LL | | "A.to_string()".to_string()
@ -10,7 +10,7 @@ LL | | }
= help: implement trait `Display` for type `A` instead = help: implement trait `Display` for type `A` instead
error: type `C` implements inherent method `to_string(&self) -> String` which shadows the implementation of `Display` error: type `C` implements inherent method `to_string(&self) -> String` which shadows the implementation of `Display`
--> $DIR/inherent_to_string.rs:45:5 --> $DIR/inherent_to_string.rs:44:5
| |
LL | / fn to_string(&self) -> String { LL | / fn to_string(&self) -> String {
LL | | "C.to_string()".to_string() LL | | "C.to_string()".to_string()

View file

@ -1,4 +1,4 @@
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)] #![allow(unused, clippy::diverging_sub_expression)]
#![warn(clippy::logic_bug)] #![warn(clippy::logic_bug)]
fn main() { fn main() {

View file

@ -1,4 +1,4 @@
#[warn(clippy::many_single_char_names)] #![warn(clippy::many_single_char_names)]
fn bla() { fn bla() {
let a: i32; let a: i32;

View file

@ -1,7 +1,7 @@
// run-rustfix // run-rustfix
#![warn(clippy::match_single_binding)] #![warn(clippy::match_single_binding)]
#![allow(unused_variables, clippy::many_single_char_names, clippy::toplevel_ref_arg)] #![allow(unused_variables, clippy::toplevel_ref_arg)]
struct Point { struct Point {
x: i32, x: i32,

View file

@ -1,7 +1,7 @@
// run-rustfix // run-rustfix
#![warn(clippy::match_single_binding)] #![warn(clippy::match_single_binding)]
#![allow(unused_variables, clippy::many_single_char_names, clippy::toplevel_ref_arg)] #![allow(unused_variables, clippy::toplevel_ref_arg)]
struct Point { struct Point {
x: i32, x: i32,

View file

@ -3,7 +3,6 @@
dead_code, dead_code,
clippy::single_match, clippy::single_match,
clippy::redundant_pattern_matching, clippy::redundant_pattern_matching,
clippy::many_single_char_names,
clippy::option_option, clippy::option_option,
clippy::redundant_clone clippy::redundant_clone
)] )]

View file

@ -1,5 +1,5 @@
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:18:23 --> $DIR/needless_pass_by_value.rs:17:23
| |
LL | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T> { LL | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T> {
| ^^^^^^ help: consider changing the type to: `&[T]` | ^^^^^^ help: consider changing the type to: `&[T]`
@ -7,55 +7,55 @@ LL | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T
= note: `-D clippy::needless-pass-by-value` implied by `-D warnings` = note: `-D clippy::needless-pass-by-value` implied by `-D warnings`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:32:11 --> $DIR/needless_pass_by_value.rs:31:11
| |
LL | fn bar(x: String, y: Wrapper) { LL | fn bar(x: String, y: Wrapper) {
| ^^^^^^ help: consider changing the type to: `&str` | ^^^^^^ help: consider changing the type to: `&str`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:32:22 --> $DIR/needless_pass_by_value.rs:31:22
| |
LL | fn bar(x: String, y: Wrapper) { LL | fn bar(x: String, y: Wrapper) {
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper` | ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:38:71 --> $DIR/needless_pass_by_value.rs:37:71
| |
LL | fn test_borrow_trait<T: Borrow<str>, U: AsRef<str>, V>(t: T, u: U, v: V) { LL | fn test_borrow_trait<T: Borrow<str>, U: AsRef<str>, V>(t: T, u: U, v: V) {
| ^ help: consider taking a reference instead: `&V` | ^ help: consider taking a reference instead: `&V`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:50:18 --> $DIR/needless_pass_by_value.rs:49:18
| |
LL | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) { LL | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) {
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&Option<Option<String>>` | ^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&Option<Option<String>>`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:63:24 --> $DIR/needless_pass_by_value.rs:62:24
| |
LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper` | ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:63:36 --> $DIR/needless_pass_by_value.rs:62:36
| |
LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) { LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper` | ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:79:49 --> $DIR/needless_pass_by_value.rs:78:49
| |
LL | fn test_blanket_ref<T: Foo, S: Serialize>(_foo: T, _serializable: S) {} LL | fn test_blanket_ref<T: Foo, S: Serialize>(_foo: T, _serializable: S) {}
| ^ help: consider taking a reference instead: `&T` | ^ help: consider taking a reference instead: `&T`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:81:18 --> $DIR/needless_pass_by_value.rs:80:18
| |
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) { LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^ help: consider taking a reference instead: `&String` | ^^^^^^ help: consider taking a reference instead: `&String`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:81:29 --> $DIR/needless_pass_by_value.rs:80:29
| |
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) { LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^ | ^^^^^^
@ -70,13 +70,13 @@ LL | let _ = t.to_string();
| ~~~~~~~~~~~~~ | ~~~~~~~~~~~~~
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:81:40 --> $DIR/needless_pass_by_value.rs:80:40
| |
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) { LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^^^ help: consider taking a reference instead: `&Vec<i32>` | ^^^^^^^^ help: consider taking a reference instead: `&Vec<i32>`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:81:53 --> $DIR/needless_pass_by_value.rs:80:53
| |
LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) { LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
| ^^^^^^^^ | ^^^^^^^^
@ -91,85 +91,85 @@ LL | let _ = v.to_owned();
| ~~~~~~~~~~~~ | ~~~~~~~~~~~~
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:94:12 --> $DIR/needless_pass_by_value.rs:93:12
| |
LL | s: String, LL | s: String,
| ^^^^^^ help: consider changing the type to: `&str` | ^^^^^^ help: consider changing the type to: `&str`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:95:12 --> $DIR/needless_pass_by_value.rs:94:12
| |
LL | t: String, LL | t: String,
| ^^^^^^ help: consider taking a reference instead: `&String` | ^^^^^^ help: consider taking a reference instead: `&String`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:104:23 --> $DIR/needless_pass_by_value.rs:103:23
| |
LL | fn baz(&self, _u: U, _s: Self) {} LL | fn baz(&self, _u: U, _s: Self) {}
| ^ help: consider taking a reference instead: `&U` | ^ help: consider taking a reference instead: `&U`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:104:30 --> $DIR/needless_pass_by_value.rs:103:30
| |
LL | fn baz(&self, _u: U, _s: Self) {} LL | fn baz(&self, _u: U, _s: Self) {}
| ^^^^ help: consider taking a reference instead: `&Self` | ^^^^ help: consider taking a reference instead: `&Self`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:126:24 --> $DIR/needless_pass_by_value.rs:125:24
| |
LL | fn bar_copy(x: u32, y: CopyWrapper) { LL | fn bar_copy(x: u32, y: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
| |
help: consider marking this type as `Copy` help: consider marking this type as `Copy`
--> $DIR/needless_pass_by_value.rs:124:1 --> $DIR/needless_pass_by_value.rs:123:1
| |
LL | struct CopyWrapper(u32); LL | struct CopyWrapper(u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:132:29 --> $DIR/needless_pass_by_value.rs:131:29
| |
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
| |
help: consider marking this type as `Copy` help: consider marking this type as `Copy`
--> $DIR/needless_pass_by_value.rs:124:1 --> $DIR/needless_pass_by_value.rs:123:1
| |
LL | struct CopyWrapper(u32); LL | struct CopyWrapper(u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:132:45 --> $DIR/needless_pass_by_value.rs:131:45
| |
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
| |
help: consider marking this type as `Copy` help: consider marking this type as `Copy`
--> $DIR/needless_pass_by_value.rs:124:1 --> $DIR/needless_pass_by_value.rs:123:1
| |
LL | struct CopyWrapper(u32); LL | struct CopyWrapper(u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:132:61 --> $DIR/needless_pass_by_value.rs:131:61
| |
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
| |
help: consider marking this type as `Copy` help: consider marking this type as `Copy`
--> $DIR/needless_pass_by_value.rs:124:1 --> $DIR/needless_pass_by_value.rs:123:1
| |
LL | struct CopyWrapper(u32); LL | struct CopyWrapper(u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:144:40 --> $DIR/needless_pass_by_value.rs:143:40
| |
LL | fn some_fun<'b, S: Bar<'b, ()>>(_item: S) {} LL | fn some_fun<'b, S: Bar<'b, ()>>(_item: S) {}
| ^ help: consider taking a reference instead: `&S` | ^ help: consider taking a reference instead: `&S`
error: this argument is passed by value, but not consumed in the function body error: this argument is passed by value, but not consumed in the function body
--> $DIR/needless_pass_by_value.rs:149:20 --> $DIR/needless_pass_by_value.rs:148:20
| |
LL | fn more_fun(_item: impl Club<'static, i32>) {} LL | fn more_fun(_item: impl Club<'static, i32>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&impl Club<'static, i32>` | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&impl Club<'static, i32>`

View file

@ -1,4 +1,4 @@
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)] #![allow(unused, clippy::diverging_sub_expression)]
#![warn(clippy::nonminimal_bool)] #![warn(clippy::nonminimal_bool)]
fn main() { fn main() {

View file

@ -1,4 +1,4 @@
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)] #![allow(unused, clippy::diverging_sub_expression)]
#![warn(clippy::nonminimal_bool)] #![warn(clippy::nonminimal_bool)]
fn methods_with_negation() { fn methods_with_negation() {

View file

@ -1,6 +1,5 @@
#![allow(unused_variables, clippy::blacklisted_name)] #![allow(unused_variables, clippy::blacklisted_name)]
#![warn(clippy::op_ref)] #![warn(clippy::op_ref)]
#![allow(clippy::many_single_char_names)]
use std::collections::HashSet; use std::collections::HashSet;
use std::ops::BitAnd; use std::ops::BitAnd;

View file

@ -1,5 +1,5 @@
error: needlessly taken reference of both operands error: needlessly taken reference of both operands
--> $DIR/op_ref.rs:12:15 --> $DIR/op_ref.rs:11:15
| |
LL | let foo = &5 - &6; LL | let foo = &5 - &6;
| ^^^^^^^ | ^^^^^^^
@ -11,7 +11,7 @@ LL | let foo = 5 - 6;
| ~ ~ | ~ ~
error: taken reference of right operand error: taken reference of right operand
--> $DIR/op_ref.rs:57:13 --> $DIR/op_ref.rs:56:13
| |
LL | let z = x & &y; LL | let z = x & &y;
| ^^^^-- | ^^^^--

View file

@ -1,4 +1,3 @@
#![allow(clippy::many_single_char_names)]
#![warn(clippy::overflow_check_conditional)] #![warn(clippy::overflow_check_conditional)]
fn main() { fn main() {

View file

@ -1,5 +1,5 @@
error: you are trying to use classic C overflow conditions that will fail in Rust error: you are trying to use classic C overflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:8:8 --> $DIR/overflow_check_conditional.rs:7:8
| |
LL | if a + b < a {} LL | if a + b < a {}
| ^^^^^^^^^ | ^^^^^^^^^
@ -7,43 +7,43 @@ LL | if a + b < a {}
= note: `-D clippy::overflow-check-conditional` implied by `-D warnings` = note: `-D clippy::overflow-check-conditional` implied by `-D warnings`
error: you are trying to use classic C overflow conditions that will fail in Rust error: you are trying to use classic C overflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:9:8 --> $DIR/overflow_check_conditional.rs:8:8
| |
LL | if a > a + b {} LL | if a > a + b {}
| ^^^^^^^^^ | ^^^^^^^^^
error: you are trying to use classic C overflow conditions that will fail in Rust error: you are trying to use classic C overflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:10:8 --> $DIR/overflow_check_conditional.rs:9:8
| |
LL | if a + b < b {} LL | if a + b < b {}
| ^^^^^^^^^ | ^^^^^^^^^
error: you are trying to use classic C overflow conditions that will fail in Rust error: you are trying to use classic C overflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:11:8 --> $DIR/overflow_check_conditional.rs:10:8
| |
LL | if b > a + b {} LL | if b > a + b {}
| ^^^^^^^^^ | ^^^^^^^^^
error: you are trying to use classic C underflow conditions that will fail in Rust error: you are trying to use classic C underflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:12:8 --> $DIR/overflow_check_conditional.rs:11:8
| |
LL | if a - b > b {} LL | if a - b > b {}
| ^^^^^^^^^ | ^^^^^^^^^
error: you are trying to use classic C underflow conditions that will fail in Rust error: you are trying to use classic C underflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:13:8 --> $DIR/overflow_check_conditional.rs:12:8
| |
LL | if b < a - b {} LL | if b < a - b {}
| ^^^^^^^^^ | ^^^^^^^^^
error: you are trying to use classic C underflow conditions that will fail in Rust error: you are trying to use classic C underflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:14:8 --> $DIR/overflow_check_conditional.rs:13:8
| |
LL | if a - b > a {} LL | if a - b > a {}
| ^^^^^^^^^ | ^^^^^^^^^
error: you are trying to use classic C underflow conditions that will fail in Rust error: you are trying to use classic C underflow conditions that will fail in Rust
--> $DIR/overflow_check_conditional.rs:15:8 --> $DIR/overflow_check_conditional.rs:14:8
| |
LL | if a < a - b {} LL | if a < a - b {}
| ^^^^^^^^^ | ^^^^^^^^^

View file

@ -1,4 +1,4 @@
#![allow(unused, clippy::many_single_char_names, clippy::redundant_clone)] #![allow(unused, clippy::redundant_clone)]
#![warn(clippy::ptr_arg)] #![warn(clippy::ptr_arg)]
use std::borrow::Cow; use std::borrow::Cow;

View file

@ -1,6 +1,6 @@
// run-rustfix // run-rustfix
#![warn(clippy::repeat_once)] #![warn(clippy::repeat_once)]
#[allow(unused, clippy::many_single_char_names, clippy::redundant_clone)] #[allow(unused, clippy::redundant_clone)]
fn main() { fn main() {
const N: usize = 1; const N: usize = 1;
let s = "str"; let s = "str";

View file

@ -1,6 +1,6 @@
// run-rustfix // run-rustfix
#![warn(clippy::repeat_once)] #![warn(clippy::repeat_once)]
#[allow(unused, clippy::many_single_char_names, clippy::redundant_clone)] #[allow(unused, clippy::redundant_clone)]
fn main() { fn main() {
const N: usize = 1; const N: usize = 1;
let s = "str"; let s = "str";

View file

@ -2,11 +2,7 @@
// normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)" // normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)"
#![deny(clippy::trivially_copy_pass_by_ref)] #![deny(clippy::trivially_copy_pass_by_ref)]
#![allow( #![allow(clippy::blacklisted_name, clippy::redundant_field_names)]
clippy::many_single_char_names,
clippy::blacklisted_name,
clippy::redundant_field_names
)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
struct Foo(u32); struct Foo(u32);

View file

@ -1,5 +1,5 @@
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:51:11 --> $DIR/trivially_copy_pass_by_ref.rs:47:11
| |
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `u32` | ^^^^ help: consider passing by value instead: `u32`
@ -11,97 +11,97 @@ LL | #![deny(clippy::trivially_copy_pass_by_ref)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:51:20 --> $DIR/trivially_copy_pass_by_ref.rs:47:20
| |
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `Foo` | ^^^^ help: consider passing by value instead: `Foo`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:51:29 --> $DIR/trivially_copy_pass_by_ref.rs:47:29
| |
LL | fn bad(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `Baz` | ^^^^ help: consider passing by value instead: `Baz`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:58:12 --> $DIR/trivially_copy_pass_by_ref.rs:54:12
| |
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
| ^^^^^ help: consider passing by value instead: `self` | ^^^^^ help: consider passing by value instead: `self`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:58:22 --> $DIR/trivially_copy_pass_by_ref.rs:54:22
| |
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `u32` | ^^^^ help: consider passing by value instead: `u32`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:58:31 --> $DIR/trivially_copy_pass_by_ref.rs:54:31
| |
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `Foo` | ^^^^ help: consider passing by value instead: `Foo`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:58:40 --> $DIR/trivially_copy_pass_by_ref.rs:54:40
| |
LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {} LL | fn bad(&self, x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `Baz` | ^^^^ help: consider passing by value instead: `Baz`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:60:16 --> $DIR/trivially_copy_pass_by_ref.rs:56:16
| |
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `u32` | ^^^^ help: consider passing by value instead: `u32`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:60:25 --> $DIR/trivially_copy_pass_by_ref.rs:56:25
| |
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `Foo` | ^^^^ help: consider passing by value instead: `Foo`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:60:34 --> $DIR/trivially_copy_pass_by_ref.rs:56:34
| |
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `Baz` | ^^^^ help: consider passing by value instead: `Baz`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:62:35 --> $DIR/trivially_copy_pass_by_ref.rs:58:35
| |
LL | fn bad_issue7518(self, other: &Self) {} LL | fn bad_issue7518(self, other: &Self) {}
| ^^^^^ help: consider passing by value instead: `Self` | ^^^^^ help: consider passing by value instead: `Self`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:74:16 --> $DIR/trivially_copy_pass_by_ref.rs:70:16
| |
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `u32` | ^^^^ help: consider passing by value instead: `u32`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:74:25 --> $DIR/trivially_copy_pass_by_ref.rs:70:25
| |
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `Foo` | ^^^^ help: consider passing by value instead: `Foo`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:74:34 --> $DIR/trivially_copy_pass_by_ref.rs:70:34
| |
LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {} LL | fn bad2(x: &u32, y: &Foo, z: &Baz) {}
| ^^^^ help: consider passing by value instead: `Baz` | ^^^^ help: consider passing by value instead: `Baz`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:78:34 --> $DIR/trivially_copy_pass_by_ref.rs:74:34
| |
LL | fn trait_method(&self, _foo: &Foo); LL | fn trait_method(&self, _foo: &Foo);
| ^^^^ help: consider passing by value instead: `Foo` | ^^^^ help: consider passing by value instead: `Foo`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:110:21 --> $DIR/trivially_copy_pass_by_ref.rs:106:21
| |
LL | fn foo_never(x: &i32) { LL | fn foo_never(x: &i32) {
| ^^^^ help: consider passing by value instead: `i32` | ^^^^ help: consider passing by value instead: `i32`
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte) error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
--> $DIR/trivially_copy_pass_by_ref.rs:115:15 --> $DIR/trivially_copy_pass_by_ref.rs:111:15
| |
LL | fn foo(x: &i32) { LL | fn foo(x: &i32) {
| ^^^^ help: consider passing by value instead: `i32` | ^^^^ help: consider passing by value instead: `i32`