Skip to content

Commit 13438b6

Browse files
authored
Merge pull request #3479 from dtolnay/literal
Downgrade large_digit_groups to pedantic
2 parents a6f4cf7 + 1a14cb3 commit 13438b6

File tree

4 files changed

+69
-69
lines changed

4 files changed

+69
-69
lines changed

clippy_lints/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
514514
if_not_else::IF_NOT_ELSE,
515515
infinite_iter::MAYBE_INFINITE_ITER,
516516
items_after_statements::ITEMS_AFTER_STATEMENTS,
517+
literal_representation::LARGE_DIGIT_GROUPS,
517518
loops::EXPLICIT_INTO_ITER_LOOP,
518519
loops::EXPLICIT_ITER_LOOP,
519520
matches::SINGLE_MATCH_ELSE,
@@ -613,7 +614,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
613614
lifetimes::EXTRA_UNUSED_LIFETIMES,
614615
lifetimes::NEEDLESS_LIFETIMES,
615616
literal_representation::INCONSISTENT_DIGIT_GROUPING,
616-
literal_representation::LARGE_DIGIT_GROUPS,
617617
literal_representation::MISTYPED_LITERAL_SUFFIXES,
618618
literal_representation::UNREADABLE_LITERAL,
619619
loops::EMPTY_LOOP,
@@ -794,7 +794,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
794794
len_zero::LEN_ZERO,
795795
let_if_seq::USELESS_LET_IF_SEQ,
796796
literal_representation::INCONSISTENT_DIGIT_GROUPING,
797-
literal_representation::LARGE_DIGIT_GROUPS,
798797
literal_representation::UNREADABLE_LITERAL,
799798
loops::EMPTY_LOOP,
800799
loops::FOR_KV_MAP,

clippy_lints/src/literal_representation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ declare_clippy_lint! {
9090
/// ```
9191
declare_clippy_lint! {
9292
pub LARGE_DIGIT_GROUPS,
93-
style,
93+
pedantic,
9494
"grouping digits into groups that are too large"
9595
}
9696

tests/ui/literals.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// option. This file may not be copied, modified, or distributed
88
// except according to those terms.
99

10+
#![warn(clippy::large_digit_groups)]
1011
#![warn(clippy::mixed_case_hex_literals)]
1112
#![warn(clippy::unseparated_literal_suffix)]
1213
#![warn(clippy::zero_prefixed_literal)]

tests/ui/literals.stderr

+66-66
Original file line numberDiff line numberDiff line change
@@ -1,217 +1,217 @@
11
error: inconsistent casing in hexadecimal literal
2-
--> $DIR/literals.rs:21:17
2+
--> $DIR/literals.rs:22:17
33
|
4-
21 | let fail1 = 0xabCD;
4+
22 | let fail1 = 0xabCD;
55
| ^^^^^^
66
|
77
= note: `-D clippy::mixed-case-hex-literals` implied by `-D warnings`
88

99
error: inconsistent casing in hexadecimal literal
10-
--> $DIR/literals.rs:22:17
10+
--> $DIR/literals.rs:23:17
1111
|
12-
22 | let fail2 = 0xabCD_u32;
12+
23 | let fail2 = 0xabCD_u32;
1313
| ^^^^^^^^^^
1414

1515
error: inconsistent casing in hexadecimal literal
16-
--> $DIR/literals.rs:23:17
16+
--> $DIR/literals.rs:24:17
1717
|
18-
23 | let fail2 = 0xabCD_isize;
18+
24 | let fail2 = 0xabCD_isize;
1919
| ^^^^^^^^^^^^
2020

2121
error: integer type suffix should be separated by an underscore
22-
--> $DIR/literals.rs:24:27
22+
--> $DIR/literals.rs:25:27
2323
|
24-
24 | let fail_multi_zero = 000_123usize;
24+
25 | let fail_multi_zero = 000_123usize;
2525
| ^^^^^^^^^^^^
2626
|
2727
= note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`
2828

2929
error: this is a decimal constant
30-
--> $DIR/literals.rs:24:27
30+
--> $DIR/literals.rs:25:27
3131
|
32-
24 | let fail_multi_zero = 000_123usize;
32+
25 | let fail_multi_zero = 000_123usize;
3333
| ^^^^^^^^^^^^
3434
|
3535
= note: `-D clippy::zero-prefixed-literal` implied by `-D warnings`
3636
help: if you mean to use a decimal constant, remove the `0` to remove confusion
3737
|
38-
24 | let fail_multi_zero = 123usize;
38+
25 | let fail_multi_zero = 123usize;
3939
| ^^^^^^^^
4040
help: if you mean to use an octal constant, use `0o`
4141
|
42-
24 | let fail_multi_zero = 0o123usize;
42+
25 | let fail_multi_zero = 0o123usize;
4343
| ^^^^^^^^^^
4444

4545
error: integer type suffix should be separated by an underscore
46-
--> $DIR/literals.rs:29:17
46+
--> $DIR/literals.rs:30:17
4747
|
48-
29 | let fail3 = 1234i32;
48+
30 | let fail3 = 1234i32;
4949
| ^^^^^^^
5050

5151
error: integer type suffix should be separated by an underscore
52-
--> $DIR/literals.rs:30:17
52+
--> $DIR/literals.rs:31:17
5353
|
54-
30 | let fail4 = 1234u32;
54+
31 | let fail4 = 1234u32;
5555
| ^^^^^^^
5656

5757
error: integer type suffix should be separated by an underscore
58-
--> $DIR/literals.rs:31:17
58+
--> $DIR/literals.rs:32:17
5959
|
60-
31 | let fail5 = 1234isize;
60+
32 | let fail5 = 1234isize;
6161
| ^^^^^^^^^
6262

6363
error: integer type suffix should be separated by an underscore
64-
--> $DIR/literals.rs:32:17
64+
--> $DIR/literals.rs:33:17
6565
|
66-
32 | let fail6 = 1234usize;
66+
33 | let fail6 = 1234usize;
6767
| ^^^^^^^^^
6868

6969
error: float type suffix should be separated by an underscore
70-
--> $DIR/literals.rs:33:17
70+
--> $DIR/literals.rs:34:17
7171
|
72-
33 | let fail7 = 1.5f32;
72+
34 | let fail7 = 1.5f32;
7373
| ^^^^^^
7474

7575
error: this is a decimal constant
76-
--> $DIR/literals.rs:37:17
76+
--> $DIR/literals.rs:38:17
7777
|
78-
37 | let fail8 = 0123;
78+
38 | let fail8 = 0123;
7979
| ^^^^
8080
help: if you mean to use a decimal constant, remove the `0` to remove confusion
8181
|
82-
37 | let fail8 = 123;
82+
38 | let fail8 = 123;
8383
| ^^^
8484
help: if you mean to use an octal constant, use `0o`
8585
|
86-
37 | let fail8 = 0o123;
86+
38 | let fail8 = 0o123;
8787
| ^^^^^
8888

8989
error: long literal lacking separators
90-
--> $DIR/literals.rs:48:17
90+
--> $DIR/literals.rs:49:17
9191
|
92-
48 | let fail9 = 0xabcdef;
92+
49 | let fail9 = 0xabcdef;
9393
| ^^^^^^^^ help: consider: `0x00ab_cdef`
9494
|
9595
= note: `-D clippy::unreadable-literal` implied by `-D warnings`
9696

9797
error: long literal lacking separators
98-
--> $DIR/literals.rs:49:18
98+
--> $DIR/literals.rs:50:18
9999
|
100-
49 | let fail10 = 0xBAFEBAFE;
100+
50 | let fail10 = 0xBAFEBAFE;
101101
| ^^^^^^^^^^ help: consider: `0xBAFE_BAFE`
102102

103103
error: long literal lacking separators
104-
--> $DIR/literals.rs:50:18
104+
--> $DIR/literals.rs:51:18
105105
|
106-
50 | let fail11 = 0xabcdeff;
106+
51 | let fail11 = 0xabcdeff;
107107
| ^^^^^^^^^ help: consider: `0x0abc_deff`
108108

109109
error: long literal lacking separators
110-
--> $DIR/literals.rs:51:18
110+
--> $DIR/literals.rs:52:18
111111
|
112-
51 | let fail12 = 0xabcabcabcabcabcabc;
112+
52 | let fail12 = 0xabcabcabcabcabcabc;
113113
| ^^^^^^^^^^^^^^^^^^^^ help: consider: `0x00ab_cabc_abca_bcab_cabc`
114114

115115
error: digit groups should be smaller
116-
--> $DIR/literals.rs:52:18
116+
--> $DIR/literals.rs:53:18
117117
|
118-
52 | let fail13 = 0x1_23456_78901_usize;
118+
53 | let fail13 = 0x1_23456_78901_usize;
119119
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `0x0123_4567_8901_usize`
120120
|
121121
= note: `-D clippy::large-digit-groups` implied by `-D warnings`
122122

123123
error: mistyped literal suffix
124-
--> $DIR/literals.rs:54:18
124+
--> $DIR/literals.rs:55:18
125125
|
126-
54 | let fail14 = 2_32;
126+
55 | let fail14 = 2_32;
127127
| ^^^^ help: did you mean to write: `2_i32`
128128
|
129129
= note: #[deny(clippy::mistyped_literal_suffixes)] on by default
130130

131131
error: mistyped literal suffix
132-
--> $DIR/literals.rs:55:18
132+
--> $DIR/literals.rs:56:18
133133
|
134-
55 | let fail15 = 4_64;
134+
56 | let fail15 = 4_64;
135135
| ^^^^ help: did you mean to write: `4_i64`
136136

137137
error: mistyped literal suffix
138-
--> $DIR/literals.rs:56:18
138+
--> $DIR/literals.rs:57:18
139139
|
140-
56 | let fail16 = 7_8;
140+
57 | let fail16 = 7_8;
141141
| ^^^ help: did you mean to write: `7_i8`
142142

143143
error: mistyped literal suffix
144-
--> $DIR/literals.rs:57:18
144+
--> $DIR/literals.rs:58:18
145145
|
146-
57 | let fail17 = 23_16;
146+
58 | let fail17 = 23_16;
147147
| ^^^^^ help: did you mean to write: `23_i16`
148148

149149
error: digits grouped inconsistently by underscores
150-
--> $DIR/literals.rs:59:18
150+
--> $DIR/literals.rs:60:18
151151
|
152-
59 | let fail19 = 12_3456_21;
152+
60 | let fail19 = 12_3456_21;
153153
| ^^^^^^^^^^ help: consider: `12_345_621`
154154
|
155155
= note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
156156

157157
error: mistyped literal suffix
158-
--> $DIR/literals.rs:60:18
158+
--> $DIR/literals.rs:61:18
159159
|
160-
60 | let fail20 = 2__8;
160+
61 | let fail20 = 2__8;
161161
| ^^^^ help: did you mean to write: `2_i8`
162162

163163
error: mistyped literal suffix
164-
--> $DIR/literals.rs:61:18
164+
--> $DIR/literals.rs:62:18
165165
|
166-
61 | let fail21 = 4___16;
166+
62 | let fail21 = 4___16;
167167
| ^^^^^^ help: did you mean to write: `4_i16`
168168

169169
error: digits grouped inconsistently by underscores
170-
--> $DIR/literals.rs:62:18
170+
--> $DIR/literals.rs:63:18
171171
|
172-
62 | let fail22 = 3__4___23;
172+
63 | let fail22 = 3__4___23;
173173
| ^^^^^^^^^ help: consider: `3_423`
174174

175175
error: digits grouped inconsistently by underscores
176-
--> $DIR/literals.rs:63:18
176+
--> $DIR/literals.rs:64:18
177177
|
178-
63 | let fail23 = 3__16___23;
178+
64 | let fail23 = 3__16___23;
179179
| ^^^^^^^^^^ help: consider: `31_623`
180180

181181
error: mistyped literal suffix
182-
--> $DIR/literals.rs:65:18
182+
--> $DIR/literals.rs:66:18
183183
|
184-
65 | let fail24 = 12.34_64;
184+
66 | let fail24 = 12.34_64;
185185
| ^^^^^^^^ help: did you mean to write: `12.34_f64`
186186

187187
error: mistyped literal suffix
188-
--> $DIR/literals.rs:66:18
188+
--> $DIR/literals.rs:67:18
189189
|
190-
66 | let fail25 = 1E2_32;
190+
67 | let fail25 = 1E2_32;
191191
| ^^^^^^ help: did you mean to write: `1E2_f32`
192192

193193
error: mistyped literal suffix
194-
--> $DIR/literals.rs:67:18
194+
--> $DIR/literals.rs:68:18
195195
|
196-
67 | let fail26 = 43E7_64;
196+
68 | let fail26 = 43E7_64;
197197
| ^^^^^^^ help: did you mean to write: `43E7_f64`
198198

199199
error: mistyped literal suffix
200-
--> $DIR/literals.rs:68:18
200+
--> $DIR/literals.rs:69:18
201201
|
202-
68 | let fail27 = 243E17_32;
202+
69 | let fail27 = 243E17_32;
203203
| ^^^^^^^^^ help: did you mean to write: `243E17_f32`
204204

205205
error: mistyped literal suffix
206-
--> $DIR/literals.rs:69:18
206+
--> $DIR/literals.rs:70:18
207207
|
208-
69 | let fail28 = 241251235E723_64;
208+
70 | let fail28 = 241251235E723_64;
209209
| ^^^^^^^^^^^^^^^^ help: did you mean to write: `241_251_235E723_f64`
210210

211211
error: mistyped literal suffix
212-
--> $DIR/literals.rs:70:18
212+
--> $DIR/literals.rs:71:18
213213
|
214-
70 | let fail29 = 42279.911_32;
214+
71 | let fail29 = 42279.911_32;
215215
| ^^^^^^^^^^^^ help: did you mean to write: `42_279.911_f32`
216216

217217
error: aborting due to 31 previous errors

0 commit comments

Comments
 (0)