Skip to content

Commit c2783c1

Browse files
committed
Downgrade many_single_char_names to pedantic
1 parent 746a005 commit c2783c1

40 files changed

+124
-139
lines changed

clippy_lints/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11371137
LintId::of(needless_continue::NEEDLESS_CONTINUE),
11381138
LintId::of(needless_for_each::NEEDLESS_FOR_EACH),
11391139
LintId::of(needless_pass_by_value::NEEDLESS_PASS_BY_VALUE),
1140+
LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES),
11401141
LintId::of(non_expressive_names::SIMILAR_NAMES),
11411142
LintId::of(pass_by_ref_or_value::LARGE_TYPES_PASSED_BY_VALUE),
11421143
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:
13931394
LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
13941395
LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
13951396
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
1396-
LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES),
13971397
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
13981398
LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS),
13991399
LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP),
@@ -1567,7 +1567,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15671567
LintId::of(non_copy_const::BORROW_INTERIOR_MUTABLE_CONST),
15681568
LintId::of(non_copy_const::DECLARE_INTERIOR_MUTABLE_CONST),
15691569
LintId::of(non_expressive_names::JUST_UNDERSCORES_AND_DIGITS),
1570-
LintId::of(non_expressive_names::MANY_SINGLE_CHAR_NAMES),
15711570
LintId::of(ptr::CMP_NULL),
15721571
LintId::of(ptr::PTR_ARG),
15731572
LintId::of(ptr_eq::PTR_EQ),

clippy_lints/src/non_expressive_names.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ declare_clippy_lint! {
4343
/// let (a, b, c, d, e, f, g) = (...);
4444
/// ```
4545
pub MANY_SINGLE_CHAR_NAMES,
46-
style,
46+
pedantic,
4747
"too many single character bindings"
4848
}
4949

clippy_utils/src/hir_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
540540
std::mem::discriminant(&b.rules).hash(&mut self.s);
541541
}
542542

543-
#[allow(clippy::many_single_char_names, clippy::too_many_lines)]
543+
#[allow(clippy::too_many_lines)]
544544
pub fn hash_expr(&mut self, e: &Expr<'_>) {
545545
let simple_const = self
546546
.maybe_typeck_results

tests/ui-toml/toml_trivially_copy/test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// normalize-stderr-test "\(limit: \d+ byte\)" -> "(limit: N byte)"
33

44
#![deny(clippy::trivially_copy_pass_by_ref)]
5-
#![allow(clippy::many_single_char_names)]
65

76
#[derive(Copy, Clone)]
87
struct Foo(u8);

tests/ui-toml/toml_trivially_copy/test.stderr

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

1313
error: this argument (N byte) is passed by reference, but would be more efficient if passed by value (limit: N byte)
14-
--> $DIR/test.rs:15:20
14+
--> $DIR/test.rs:14:20
1515
|
1616
LL | fn bad(x: &u16, y: &Foo) {}
1717
| ^^^^ help: consider passing by value instead: `Foo`

tests/ui/deref_addrof.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn get_reference(n: &usize) -> &usize {
99
n
1010
}
1111

12-
#[allow(clippy::many_single_char_names, clippy::double_parens)]
12+
#[allow(clippy::double_parens)]
1313
#[allow(unused_variables, unused_parens)]
1414
fn main() {
1515
let a = 10;

tests/ui/deref_addrof.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn get_reference(n: &usize) -> &usize {
99
n
1010
}
1111

12-
#[allow(clippy::many_single_char_names, clippy::double_parens)]
12+
#[allow(clippy::double_parens)]
1313
#[allow(unused_variables, unused_parens)]
1414
fn main() {
1515
let a = 10;

tests/ui/eq_op.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#[rustfmt::skip]
44
#[warn(clippy::eq_op)]
5-
#[allow(clippy::identity_op, clippy::double_parens, clippy::many_single_char_names)]
5+
#[allow(clippy::identity_op, clippy::double_parens)]
66
#[allow(clippy::no_effect, unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)]
77
#[allow(clippy::nonminimal_bool)]
88
#[allow(unused)]

tests/ui/eta.fixed

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
unused,
55
clippy::no_effect,
66
clippy::redundant_closure_call,
7-
clippy::many_single_char_names,
87
clippy::needless_pass_by_value,
98
clippy::option_map_unit_fn
109
)]

tests/ui/eta.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
unused,
55
clippy::no_effect,
66
clippy::redundant_closure_call,
7-
clippy::many_single_char_names,
87
clippy::needless_pass_by_value,
98
clippy::option_map_unit_fn
109
)]

tests/ui/eta.stderr

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,131 @@
11
error: redundant closure
2-
--> $DIR/eta.rs:32:27
2+
--> $DIR/eta.rs:31:27
33
|
44
LL | let a = Some(1u8).map(|a| foo(a));
55
| ^^^^^^^^^^ help: replace the closure with the function itself: `foo`
66
|
77
= note: `-D clippy::redundant-closure` implied by `-D warnings`
88

99
error: redundant closure
10-
--> $DIR/eta.rs:36:40
10+
--> $DIR/eta.rs:35:40
1111
|
1212
LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
1313
| ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
1414

1515
error: redundant closure
16-
--> $DIR/eta.rs:37:35
16+
--> $DIR/eta.rs:36:35
1717
|
1818
LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted?
1919
| ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
2020

2121
error: this expression borrows a reference (`&u8`) that is immediately dereferenced by the compiler
22-
--> $DIR/eta.rs:38:21
22+
--> $DIR/eta.rs:37:21
2323
|
2424
LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
2525
| ^^^ help: change this to: `&2`
2626
|
2727
= note: `-D clippy::needless-borrow` implied by `-D warnings`
2828

2929
error: redundant closure
30-
--> $DIR/eta.rs:38:26
30+
--> $DIR/eta.rs:37:26
3131
|
3232
LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
3333
| ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
3434

3535
error: redundant closure
36-
--> $DIR/eta.rs:44:27
36+
--> $DIR/eta.rs:43:27
3737
|
3838
LL | let e = Some(1u8).map(|a| divergent(a));
3939
| ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `divergent`
4040

4141
error: redundant closure
42-
--> $DIR/eta.rs:45:27
42+
--> $DIR/eta.rs:44:27
4343
|
4444
LL | let e = Some(1u8).map(|a| generic(a));
4545
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
4646

4747
error: redundant closure
48-
--> $DIR/eta.rs:91:51
48+
--> $DIR/eta.rs:90:51
4949
|
5050
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
5151
| ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
5252
|
5353
= note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
5454

5555
error: redundant closure
56-
--> $DIR/eta.rs:92:51
56+
--> $DIR/eta.rs:91:51
5757
|
5858
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
5959
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
6060

6161
error: redundant closure
62-
--> $DIR/eta.rs:94:42
62+
--> $DIR/eta.rs:93:42
6363
|
6464
LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
6565
| ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
6666

6767
error: redundant closure
68-
--> $DIR/eta.rs:98:29
68+
--> $DIR/eta.rs:97:29
6969
|
7070
LL | let e = Some("str").map(|s| s.to_string());
7171
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
7272

7373
error: redundant closure
74-
--> $DIR/eta.rs:99:27
74+
--> $DIR/eta.rs:98:27
7575
|
7676
LL | let e = Some('a').map(|s| s.to_uppercase());
7777
| ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
7878

7979
error: redundant closure
80-
--> $DIR/eta.rs:101:65
80+
--> $DIR/eta.rs:100:65
8181
|
8282
LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
8484

8585
error: redundant closure
86-
--> $DIR/eta.rs:164:22
86+
--> $DIR/eta.rs:163:22
8787
|
8888
LL | requires_fn_once(|| x());
8989
| ^^^^^^ help: replace the closure with the function itself: `x`
9090

9191
error: redundant closure
92-
--> $DIR/eta.rs:171:27
92+
--> $DIR/eta.rs:170:27
9393
|
9494
LL | let a = Some(1u8).map(|a| foo_ptr(a));
9595
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
9696

9797
error: redundant closure
98-
--> $DIR/eta.rs:176:27
98+
--> $DIR/eta.rs:175:27
9999
|
100100
LL | let a = Some(1u8).map(|a| closure(a));
101101
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
102102

103103
error: redundant closure
104-
--> $DIR/eta.rs:208:28
104+
--> $DIR/eta.rs:207:28
105105
|
106106
LL | x.into_iter().for_each(|x| add_to_res(x));
107107
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
108108

109109
error: redundant closure
110-
--> $DIR/eta.rs:209:28
110+
--> $DIR/eta.rs:208:28
111111
|
112112
LL | y.into_iter().for_each(|x| add_to_res(x));
113113
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
114114

115115
error: redundant closure
116-
--> $DIR/eta.rs:210:28
116+
--> $DIR/eta.rs:209:28
117117
|
118118
LL | z.into_iter().for_each(|x| add_to_res(x));
119119
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
120120

121121
error: redundant closure
122-
--> $DIR/eta.rs:217:21
122+
--> $DIR/eta.rs:216:21
123123
|
124124
LL | Some(1).map(|n| closure(n));
125125
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
126126

127127
error: redundant closure
128-
--> $DIR/eta.rs:236:21
128+
--> $DIR/eta.rs:235:21
129129
|
130130
LL | map_str_to_path(|s| s.as_ref());
131131
| ^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::convert::AsRef::as_ref`

tests/ui/eval_order_dependence.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#[allow(
55
unused_assignments,
66
unused_variables,
7-
clippy::many_single_char_names,
87
clippy::no_effect,
98
dead_code,
109
clippy::blacklisted_name

tests/ui/eval_order_dependence.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
error: unsequenced read of `x`
2-
--> $DIR/eval_order_dependence.rs:17:9
2+
--> $DIR/eval_order_dependence.rs:16:9
33
|
44
LL | } + x;
55
| ^
66
|
77
= note: `-D clippy::eval-order-dependence` implied by `-D warnings`
88
note: whether read occurs before this write depends on evaluation order
9-
--> $DIR/eval_order_dependence.rs:15:9
9+
--> $DIR/eval_order_dependence.rs:14:9
1010
|
1111
LL | x = 1;
1212
| ^^^^^
1313

1414
error: unsequenced read of `x`
15-
--> $DIR/eval_order_dependence.rs:20:5
15+
--> $DIR/eval_order_dependence.rs:19:5
1616
|
1717
LL | x += {
1818
| ^
1919
|
2020
note: whether read occurs before this write depends on evaluation order
21-
--> $DIR/eval_order_dependence.rs:21:9
21+
--> $DIR/eval_order_dependence.rs:20:9
2222
|
2323
LL | x = 20;
2424
| ^^^^^^
2525

2626
error: unsequenced read of `x`
27-
--> $DIR/eval_order_dependence.rs:33:12
27+
--> $DIR/eval_order_dependence.rs:32:12
2828
|
2929
LL | a: x,
3030
| ^
3131
|
3232
note: whether read occurs before this write depends on evaluation order
33-
--> $DIR/eval_order_dependence.rs:35:13
33+
--> $DIR/eval_order_dependence.rs:34:13
3434
|
3535
LL | x = 6;
3636
| ^^^^^
3737

3838
error: unsequenced read of `x`
39-
--> $DIR/eval_order_dependence.rs:42:9
39+
--> $DIR/eval_order_dependence.rs:41:9
4040
|
4141
LL | x += {
4242
| ^
4343
|
4444
note: whether read occurs before this write depends on evaluation order
45-
--> $DIR/eval_order_dependence.rs:43:13
45+
--> $DIR/eval_order_dependence.rs:42:13
4646
|
4747
LL | x = 20;
4848
| ^^^^^^

tests/ui/explicit_deref_methods.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

3-
#![allow(unused_variables, clippy::many_single_char_names, clippy::clone_double_ref)]
3+
#![allow(unused_variables, clippy::clone_double_ref)]
44
#![warn(clippy::explicit_deref_methods)]
55

66
use std::ops::{Deref, DerefMut};

tests/ui/explicit_deref_methods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

3-
#![allow(unused_variables, clippy::many_single_char_names, clippy::clone_double_ref)]
3+
#![allow(unused_variables, clippy::clone_double_ref)]
44
#![warn(clippy::explicit_deref_methods)]
55

66
use std::ops::{Deref, DerefMut};

tests/ui/float_cmp.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
clippy::no_effect,
55
clippy::op_ref,
66
clippy::unnecessary_operation,
7-
clippy::cast_lossless,
8-
clippy::many_single_char_names
7+
clippy::cast_lossless
98
)]
109

1110
use std::ops::Add;

0 commit comments

Comments
 (0)