Skip to content

Commit 2011d9a

Browse files
authored
Rollup merge of #5419 - dtolnay:unreadable, r=flip1995
Downgrade unreadable_literal to pedantic As motivated by #5418. This is the top most commonly suppressed Clippy style lint, which indicates that the community has decided they don't share Clippy's opinion on the best style of this. I've left the lint in as pedantic, though it could be that "restriction" would be better -- I can see this lint being useful as an opt-in restriction in some codebases. changelog: Remove unreadable_literal from default set of enabled lints
2 parents f84b72b + be34bc4 commit 2011d9a

7 files changed

+21
-16
lines changed

Diff for: clippy_lints/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11051105
LintId::of(&items_after_statements::ITEMS_AFTER_STATEMENTS),
11061106
LintId::of(&large_stack_arrays::LARGE_STACK_ARRAYS),
11071107
LintId::of(&literal_representation::LARGE_DIGIT_GROUPS),
1108+
LintId::of(&literal_representation::UNREADABLE_LITERAL),
11081109
LintId::of(&loops::EXPLICIT_INTO_ITER_LOOP),
11091110
LintId::of(&loops::EXPLICIT_ITER_LOOP),
11101111
LintId::of(&macro_use::MACRO_USE_IMPORTS),
@@ -1229,7 +1230,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12291230
LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
12301231
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
12311232
LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
1232-
LintId::of(&literal_representation::UNREADABLE_LITERAL),
12331233
LintId::of(&loops::EMPTY_LOOP),
12341234
LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
12351235
LintId::of(&loops::FOR_KV_MAP),
@@ -1436,7 +1436,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14361436
LintId::of(&len_zero::LEN_ZERO),
14371437
LintId::of(&let_if_seq::USELESS_LET_IF_SEQ),
14381438
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
1439-
LintId::of(&literal_representation::UNREADABLE_LITERAL),
14401439
LintId::of(&loops::EMPTY_LOOP),
14411440
LintId::of(&loops::FOR_KV_MAP),
14421441
LintId::of(&loops::NEEDLESS_RANGE_LOOP),

Diff for: clippy_lints/src/literal_representation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ declare_clippy_lint! {
2727
/// let x: u64 = 61864918973511;
2828
/// ```
2929
pub UNREADABLE_LITERAL,
30-
style,
30+
pedantic,
3131
"long integer literal without underscores"
3232
}
3333

Diff for: src/lintlist/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
23012301
},
23022302
Lint {
23032303
name: "unreadable_literal",
2304-
group: "style",
2304+
group: "pedantic",
23052305
desc: "long integer literal without underscores",
23062306
deprecation: None,
23072307
module: "literal_representation",

Diff for: tests/ui/approx_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[warn(clippy::approx_constant)]
2-
#[allow(unused, clippy::shadow_unrelated, clippy::similar_names, clippy::unreadable_literal)]
2+
#[allow(unused, clippy::shadow_unrelated, clippy::similar_names)]
33
fn main() {
44
let my_e = 2.7182;
55
let almost_e = 2.718;

Diff for: tests/ui/inconsistent_digit_grouping.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#[warn(clippy::inconsistent_digit_grouping)]
3+
#[deny(clippy::unreadable_literal)]
34
#[allow(unused_variables, clippy::excessive_precision)]
45
fn main() {
56
macro_rules! mac1 {

Diff for: tests/ui/inconsistent_digit_grouping.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-rustfix
22
#[warn(clippy::inconsistent_digit_grouping)]
3+
#[deny(clippy::unreadable_literal)]
34
#[allow(unused_variables, clippy::excessive_precision)]
45
fn main() {
56
macro_rules! mac1 {

Diff for: tests/ui/inconsistent_digit_grouping.stderr

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,67 @@
11
error: digits grouped inconsistently by underscores
2-
--> $DIR/inconsistent_digit_grouping.rs:25:16
2+
--> $DIR/inconsistent_digit_grouping.rs:26:16
33
|
44
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
55
| ^^^^^^^^ help: consider: `123_456`
66
|
77
= note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
88

99
error: digits grouped inconsistently by underscores
10-
--> $DIR/inconsistent_digit_grouping.rs:25:26
10+
--> $DIR/inconsistent_digit_grouping.rs:26:26
1111
|
1212
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
1313
| ^^^^^^^^^^ help: consider: `12_345_678`
1414

1515
error: digits grouped inconsistently by underscores
16-
--> $DIR/inconsistent_digit_grouping.rs:25:38
16+
--> $DIR/inconsistent_digit_grouping.rs:26:38
1717
|
1818
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
1919
| ^^^^^^^^ help: consider: `1_234_567`
2020

2121
error: digits grouped inconsistently by underscores
22-
--> $DIR/inconsistent_digit_grouping.rs:25:48
22+
--> $DIR/inconsistent_digit_grouping.rs:26:48
2323
|
2424
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
2525
| ^^^^^^^^^^^^^^ help: consider: `1_234.567_8_f32`
2626

2727
error: digits grouped inconsistently by underscores
28-
--> $DIR/inconsistent_digit_grouping.rs:25:64
28+
--> $DIR/inconsistent_digit_grouping.rs:26:64
2929
|
3030
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
3131
| ^^^^^^^^^^^^^^ help: consider: `1.234_567_8_f32`
3232

3333
error: long literal lacking separators
34-
--> $DIR/inconsistent_digit_grouping.rs:28:13
34+
--> $DIR/inconsistent_digit_grouping.rs:29:13
3535
|
3636
LL | let _ = 0x100000;
3737
| ^^^^^^^^ help: consider: `0x0010_0000`
3838
|
39-
= note: `-D clippy::unreadable-literal` implied by `-D warnings`
39+
note: the lint level is defined here
40+
--> $DIR/inconsistent_digit_grouping.rs:3:8
41+
|
42+
LL | #[deny(clippy::unreadable_literal)]
43+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
4044

4145
error: long literal lacking separators
42-
--> $DIR/inconsistent_digit_grouping.rs:29:13
46+
--> $DIR/inconsistent_digit_grouping.rs:30:13
4347
|
4448
LL | let _ = 0x1000000;
4549
| ^^^^^^^^^ help: consider: `0x0100_0000`
4650

4751
error: long literal lacking separators
48-
--> $DIR/inconsistent_digit_grouping.rs:30:13
52+
--> $DIR/inconsistent_digit_grouping.rs:31:13
4953
|
5054
LL | let _ = 0x10000000;
5155
| ^^^^^^^^^^ help: consider: `0x1000_0000`
5256

5357
error: long literal lacking separators
54-
--> $DIR/inconsistent_digit_grouping.rs:31:13
58+
--> $DIR/inconsistent_digit_grouping.rs:32:13
5559
|
5660
LL | let _ = 0x100000000_u64;
5761
| ^^^^^^^^^^^^^^^ help: consider: `0x0001_0000_0000_u64`
5862

5963
error: digits grouped inconsistently by underscores
60-
--> $DIR/inconsistent_digit_grouping.rs:34:18
64+
--> $DIR/inconsistent_digit_grouping.rs:35:18
6165
|
6266
LL | let _: f32 = 1_23_456.;
6367
| ^^^^^^^^^ help: consider: `123_456.`

0 commit comments

Comments
 (0)