Skip to content

Commit 312bbff

Browse files
committed
Integrate suggestions from code review
1 parent e7e4b35 commit 312bbff

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2017,7 +2017,7 @@ Released 2018-09-13
20172017
[`unused_label`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_label
20182018
[`unused_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
20192019
[`unused_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
2020-
[`unusual_byte_grouping`]: https://rust-lang.github.io/rust-clippy/master/index.html#unusual_byte_grouping
2020+
[`unusual_byte_groupings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unusual_byte_groupings
20212021
[`unwrap_in_result`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_in_result
20222022
[`unwrap_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
20232023
[`use_debug`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_debug

clippy_lints/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
623623
&literal_representation::LARGE_DIGIT_GROUPS,
624624
&literal_representation::MISTYPED_LITERAL_SUFFIXES,
625625
&literal_representation::UNREADABLE_LITERAL,
626-
&literal_representation::UNUSUAL_BYTE_GROUPING,
626+
&literal_representation::UNUSUAL_BYTE_GROUPINGS,
627627
&loops::EMPTY_LOOP,
628628
&loops::EXPLICIT_COUNTER_LOOP,
629629
&loops::EXPLICIT_INTO_ITER_LOOP,
@@ -1366,7 +1366,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
13661366
LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
13671367
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
13681368
LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
1369-
LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPING),
1369+
LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPINGS),
13701370
LintId::of(&loops::EMPTY_LOOP),
13711371
LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
13721372
LintId::of(&loops::FOR_KV_MAP),
@@ -1589,7 +1589,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15891589
LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
15901590
LintId::of(&len_zero::LEN_ZERO),
15911591
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
1592-
LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPING),
1592+
LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPINGS),
15931593
LintId::of(&loops::EMPTY_LOOP),
15941594
LintId::of(&loops::FOR_KV_MAP),
15951595
LintId::of(&loops::NEEDLESS_RANGE_LOOP),

clippy_lints/src/literal_representation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ declare_clippy_lint! {
9696
/// let x: u32 = 0xFFF_FFF;
9797
/// let y: u8 = 0b01_011_101;
9898
/// ```
99-
pub UNUSUAL_BYTE_GROUPING,
99+
pub UNUSUAL_BYTE_GROUPINGS,
100100
style,
101101
"binary or hex literals that aren't grouped by four"
102102
}
@@ -144,7 +144,7 @@ enum WarningType {
144144
LargeDigitGroups,
145145
DecimalRepresentation,
146146
MistypedLiteralSuffix,
147-
UnusualByteGrouping,
147+
UnusualByteGroupings,
148148
}
149149

150150
impl WarningType {
@@ -195,9 +195,9 @@ impl WarningType {
195195
suggested_format,
196196
Applicability::MachineApplicable,
197197
),
198-
Self::UnusualByteGrouping => span_lint_and_sugg(
198+
Self::UnusualByteGroupings => span_lint_and_sugg(
199199
cx,
200-
UNUSUAL_BYTE_GROUPING,
200+
UNUSUAL_BYTE_GROUPINGS,
201201
span,
202202
"digits of hex or binary literal not grouped by four",
203203
"consider",
@@ -213,7 +213,7 @@ declare_lint_pass!(LiteralDigitGrouping => [
213213
INCONSISTENT_DIGIT_GROUPING,
214214
LARGE_DIGIT_GROUPS,
215215
MISTYPED_LITERAL_SUFFIXES,
216-
UNUSUAL_BYTE_GROUPING,
216+
UNUSUAL_BYTE_GROUPINGS,
217217
]);
218218

219219
impl EarlyLintPass for LiteralDigitGrouping {
@@ -268,7 +268,7 @@ impl LiteralDigitGrouping {
268268
let should_warn = match warning_type {
269269
| WarningType::UnreadableLiteral
270270
| WarningType::InconsistentDigitGrouping
271-
| WarningType::UnusualByteGrouping
271+
| WarningType::UnusualByteGroupings
272272
| WarningType::LargeDigitGroups => {
273273
!in_macro(lit.span)
274274
}
@@ -369,7 +369,7 @@ impl LiteralDigitGrouping {
369369
let first = groups.next().expect("At least one group");
370370

371371
if (radix == Radix::Binary || radix == Radix::Hexadecimal) && groups.any(|i| i != 4 && i != 2) {
372-
return Err(WarningType::UnusualByteGrouping);
372+
return Err(WarningType::UnusualByteGroupings);
373373
}
374374

375375
if let Some(second) = groups.next() {

src/lintlist/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2644,7 +2644,7 @@ vec![
26442644
module: "unused_unit",
26452645
},
26462646
Lint {
2647-
name: "unusual_byte_grouping",
2647+
name: "unusual_byte_groupings",
26482648
group: "style",
26492649
desc: "binary or hex literals that aren\'t grouped by four",
26502650
deprecation: None,

tests/ui/large_digit_groups.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: digits of hex or binary literal not grouped by four
44
LL | 0x1_234_567,
55
| ^^^^^^^^^^^ help: consider: `0x0123_4567`
66
|
7-
= note: `-D clippy::unusual-byte-grouping` implied by `-D warnings`
7+
= note: `-D clippy::unusual-byte-groupings` implied by `-D warnings`
88

99
error: digits of hex or binary literal not grouped by four
1010
--> $DIR/large_digit_groups.rs:22:9

tests/ui/literals.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
fn main() {
99
let ok1 = 0xABCD;
10-
let ok3 = 0xabcd;
11-
let ok4 = 0xabcd_i32;
12-
let ok5 = 0xABCD_u32;
13-
let ok5 = 0xABCD_isize;
10+
let ok3 = 0xab_cd;
11+
let ok4 = 0xab_cd_i32;
12+
let ok5 = 0xAB_CD_u32;
13+
let ok5 = 0xAB_CD_isize;
1414
let fail1 = 0xabCD;
1515
let fail2 = 0xabCD_u32;
1616
let fail2 = 0xabCD_isize;

tests/ui/literals.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ error: digits of hex or binary literal not grouped by four
7575
LL | let fail24 = 0xAB_ABC_AB;
7676
| ^^^^^^^^^^^ help: consider: `0x0ABA_BCAB`
7777
|
78-
= note: `-D clippy::unusual-byte-grouping` implied by `-D warnings`
78+
= note: `-D clippy::unusual-byte-groupings` implied by `-D warnings`
7979

8080
error: digits of hex or binary literal not grouped by four
8181
--> $DIR/literals.rs:38:18

tests/ui/unreadable_literal.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: digits of hex or binary literal not grouped by four
44
LL | 0x1_234_567,
55
| ^^^^^^^^^^^ help: consider: `0x0123_4567`
66
|
7-
= note: `-D clippy::unusual-byte-grouping` implied by `-D warnings`
7+
= note: `-D clippy::unusual-byte-groupings` implied by `-D warnings`
88

99
error: long literal lacking separators
1010
--> $DIR/unreadable_literal.rs:25:17

0 commit comments

Comments
 (0)