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_for_each::NEEDLESS_FOR_EACH),
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(pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE),
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::DECLARE_INTERIOR_MUTABLE_CONST),
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(open_options::NONSENSICAL_OPEN_OPTIONS),
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::DECLARE_INTERIOR_MUTABLE_CONST),
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::PTR_ARG),
LintId::of(ptr_eq::PTR_EQ),

View File

@ -43,7 +43,7 @@ declare_clippy_lint! {
/// let (a, b, c, d, e, f, g) = (...);
/// ```
pub MANY_SINGLE_CHAR_NAMES,
style,
pedantic,
"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);
}
#[allow(clippy::many_single_char_names, clippy::too_many_lines)]
#[allow(clippy::too_many_lines)]
pub fn hash_expr(&mut self, e: &Expr<'_>) {
let simple_const = self
.maybe_typeck_results

View File

@ -2,7 +2,6 @@
// normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)"
#![deny(clippy::trivially_copy_pass_by_ref)]
#![allow(clippy::many_single_char_names)]
#[derive(Copy, Clone)]
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)
--> $DIR/test.rs:15:11
--> $DIR/test.rs:14:11
|
LL | fn bad(x: &u16, y: &Foo) {}
| ^^^^ 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)
--> $DIR/test.rs:15:20
--> $DIR/test.rs:14:20
|
LL | fn bad(x: &u16, y: &Foo) {}
| ^^^^ help: consider passing by value instead: `Foo`

View File

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

View File

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

View File

@ -2,7 +2,7 @@
#[rustfmt::skip]
#[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::nonminimal_bool)]
#[allow(unused)]

View File

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

View File

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

View File

@ -1,5 +1,5 @@
error: redundant closure
--> $DIR/eta.rs:32:27
--> $DIR/eta.rs:31:27
|
LL | let a = Some(1u8).map(|a| foo(a));
| ^^^^^^^^^^ 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`
error: redundant closure
--> $DIR/eta.rs:36:40
--> $DIR/eta.rs:35:40
|
LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
| ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
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?
| ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
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
| ^^^ 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`
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
| ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
error: redundant closure
--> $DIR/eta.rs:44:27
--> $DIR/eta.rs:43:27
|
LL | let e = Some(1u8).map(|a| divergent(a));
| ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `divergent`
error: redundant closure
--> $DIR/eta.rs:45:27
--> $DIR/eta.rs:44:27
|
LL | let e = Some(1u8).map(|a| generic(a));
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
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());
| ^^^^^^^^^^^ 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`
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());
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
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());
| ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
error: redundant closure
--> $DIR/eta.rs:98:29
--> $DIR/eta.rs:97:29
|
LL | let e = Some("str").map(|s| s.to_string());
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
error: redundant closure
--> $DIR/eta.rs:99:27
--> $DIR/eta.rs:98:27
|
LL | let e = Some('a').map(|s| s.to_uppercase());
| ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
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();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
error: redundant closure
--> $DIR/eta.rs:164:22
--> $DIR/eta.rs:163:22
|
LL | requires_fn_once(|| x());
| ^^^^^^ help: replace the closure with the function itself: `x`
error: redundant closure
--> $DIR/eta.rs:171:27
--> $DIR/eta.rs:170:27
|
LL | let a = Some(1u8).map(|a| foo_ptr(a));
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
error: redundant closure
--> $DIR/eta.rs:176:27
--> $DIR/eta.rs:175:27
|
LL | let a = Some(1u8).map(|a| closure(a));
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `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));
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
error: redundant closure
--> $DIR/eta.rs:209:28
--> $DIR/eta.rs:208:28
|
LL | y.into_iter().for_each(|x| add_to_res(x));
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
error: redundant closure
--> $DIR/eta.rs:210:28
--> $DIR/eta.rs:209:28
|
LL | z.into_iter().for_each(|x| add_to_res(x));
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
error: redundant closure
--> $DIR/eta.rs:217:21
--> $DIR/eta.rs:216:21
|
LL | Some(1).map(|n| closure(n));
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
error: redundant closure
--> $DIR/eta.rs:236:21
--> $DIR/eta.rs:235:21
|
LL | map_str_to_path(|s| s.as_ref());
| ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::convert::AsRef::as_ref`

View File

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

View File

@ -1,48 +1,48 @@
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:17:9
--> $DIR/eval_order_dependence.rs:16:9
|
LL | } + x;
| ^
|
= note: `-D clippy::eval-order-dependence` implied by `-D warnings`
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;
| ^^^^^
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:20:5
--> $DIR/eval_order_dependence.rs:19:5
|
LL | x += {
| ^
|
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;
| ^^^^^^
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:33:12
--> $DIR/eval_order_dependence.rs:32:12
|
LL | a: x,
| ^
|
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;
| ^^^^^
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:42:9
--> $DIR/eval_order_dependence.rs:41:9
|
LL | x += {
| ^
|
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;
| ^^^^^^

View File

@ -1,6 +1,6 @@
// 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)]
use std::ops::{Deref, DerefMut};

View File

@ -1,6 +1,6 @@
// 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)]
use std::ops::{Deref, DerefMut};

View File

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

View File

@ -1,5 +1,5 @@
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;
| ^^^^^^^^^^^^^^^^^ 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`
error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:63:5
--> $DIR/float_cmp.rs:62:5
|
LL | x == 1.0;
| ^^^^^^^^ 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`
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);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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`
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];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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`
error: strict comparison of `f32` or `f64` arrays
--> $DIR/float_cmp.rs:91:5
--> $DIR/float_cmp.rs:90:5
|
LL | a1 == a2;
| ^^^^^^^^
@ -40,7 +40,7 @@ LL | a1 == a2;
= note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin`
error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:92:5
--> $DIR/float_cmp.rs:91:5
|
LL | a1[0] == a2[0];
| ^^^^^^^^^^^^^^ 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::similar_names
)]
#[allow(clippy::many_single_char_names, unused_variables)]
#[allow(unused_variables)]
fn main() {
let mut vec = vec![1, 2, 3, 4];

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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 {
| ^^^^^^
@ -8,7 +8,7 @@ LL | while y < 10 {
= 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
--> $DIR/infinite_loop.rs:28:11
--> $DIR/infinite_loop.rs:27:11
|
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
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 {
| ^^^^^
@ -24,7 +24,7 @@ LL | while !cond {
= 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
--> $DIR/infinite_loop.rs:79:11
--> $DIR/infinite_loop.rs:78:11
|
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
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 {
| ^^^^^^^^^^^^^^
@ -40,7 +40,7 @@ LL | while i < 3 && j > 0 {
= 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
--> $DIR/infinite_loop.rs:88:11
--> $DIR/infinite_loop.rs:87:11
|
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
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 {
| ^^^^^
@ -56,7 +56,7 @@ LL | while i < 3 {
= 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
--> $DIR/infinite_loop.rs:108:11
--> $DIR/infinite_loop.rs:107:11
|
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
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 {
| ^^^^^^^^^^^^^^
@ -72,7 +72,7 @@ LL | while self.count < n {
= 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
--> $DIR/infinite_loop.rs:182:11
--> $DIR/infinite_loop.rs:181:11
|
LL | while y < 10 {
| ^^^^^^
@ -82,7 +82,7 @@ LL | while y < 10 {
= help: rewrite it as `if cond { loop { } }`
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 {
| ^^^^^^

View File

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

View File

@ -1,5 +1,5 @@
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 | | "A.to_string()".to_string()
@ -10,7 +10,7 @@ LL | | }
= help: implement trait `Display` for type `A` instead
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 | | "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)]
fn main() {

View File

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

View File

@ -1,7 +1,7 @@
// run-rustfix
#![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 {
x: i32,

View File

@ -1,7 +1,7 @@
// run-rustfix
#![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 {
x: i32,

View File

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

View File

@ -1,5 +1,5 @@
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> {
| ^^^^^^ 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`
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) {
| ^^^^^^ help: consider changing the type to: `&str`
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) {
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
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) {
| ^ help: consider taking a reference instead: `&V`
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>>) {
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&Option<Option<String>>`
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) {
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
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) {
| ^^^^^^^ help: consider taking a reference instead: `&Wrapper`
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) {}
| ^ help: consider taking a reference instead: `&T`
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>) {
| ^^^^^^ help: consider taking a reference instead: `&String`
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>) {
| ^^^^^^
@ -70,13 +70,13 @@ LL | let _ = t.to_string();
| ~~~~~~~~~~~~~
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>) {
| ^^^^^^^^ help: consider taking a reference instead: `&Vec<i32>`
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>) {
| ^^^^^^^^
@ -91,85 +91,85 @@ LL | let _ = v.to_owned();
| ~~~~~~~~~~~~
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,
| ^^^^^^ help: consider changing the type to: `&str`
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,
| ^^^^^^ help: consider taking a reference instead: `&String`
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) {}
| ^ help: consider taking a reference instead: `&U`
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) {}
| ^^^^ help: consider taking a reference instead: `&Self`
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) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
|
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);
| ^^^^^^^^^^^^^^^^^^^^^^^^
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) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
|
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);
| ^^^^^^^^^^^^^^^^^^^^^^^^
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) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
|
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);
| ^^^^^^^^^^^^^^^^^^^^^^^^
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) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
|
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);
| ^^^^^^^^^^^^^^^^^^^^^^^^
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) {}
| ^ help: consider taking a reference instead: `&S`
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>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ 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)]
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)]
fn methods_with_negation() {

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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 {}
| ^^^^^^^^^
@ -7,43 +7,43 @@ LL | if a + b < a {}
= 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
--> $DIR/overflow_check_conditional.rs:9:8
--> $DIR/overflow_check_conditional.rs:8:8
|
LL | if a > a + b {}
| ^^^^^^^^^
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 {}
| ^^^^^^^^^
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 {}
| ^^^^^^^^^
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 {}
| ^^^^^^^^^
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 {}
| ^^^^^^^^^
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 {}
| ^^^^^^^^^
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 {}
| ^^^^^^^^^

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)]
use std::borrow::Cow;

View File

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

View File

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

View File

@ -2,11 +2,7 @@
// normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)"
#![deny(clippy::trivially_copy_pass_by_ref)]
#![allow(
clippy::many_single_char_names,
clippy::blacklisted_name,
clippy::redundant_field_names
)]
#![allow(clippy::blacklisted_name, clippy::redundant_field_names)]
#[derive(Copy, Clone)]
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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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) {}
| ^^^^ 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)
--> $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);
| ^^^^ 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)
--> $DIR/trivially_copy_pass_by_ref.rs:110:21
--> $DIR/trivially_copy_pass_by_ref.rs:106:21
|
LL | fn foo_never(x: &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)
--> $DIR/trivially_copy_pass_by_ref.rs:115:15
--> $DIR/trivially_copy_pass_by_ref.rs:111:15
|
LL | fn foo(x: &i32) {
| ^^^^ help: consider passing by value instead: `i32`