Integrate suggestions from code review

This commit is contained in:
cgm616 2020-10-25 11:31:24 -04:00
parent e7e4b35bdf
commit 312bbff696
No known key found for this signature in database
GPG key ID: 40CAAC85E9C1ED60
8 changed files with 19 additions and 19 deletions

View file

@ -623,7 +623,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&literal_representation::LARGE_DIGIT_GROUPS,
&literal_representation::MISTYPED_LITERAL_SUFFIXES,
&literal_representation::UNREADABLE_LITERAL,
&literal_representation::UNUSUAL_BYTE_GROUPING,
&literal_representation::UNUSUAL_BYTE_GROUPINGS,
&loops::EMPTY_LOOP,
&loops::EXPLICIT_COUNTER_LOOP,
&loops::EXPLICIT_INTO_ITER_LOOP,
@ -1366,7 +1366,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPING),
LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPINGS),
LintId::of(&loops::EMPTY_LOOP),
LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
LintId::of(&loops::FOR_KV_MAP),
@ -1589,7 +1589,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
LintId::of(&len_zero::LEN_ZERO),
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPING),
LintId::of(&literal_representation::UNUSUAL_BYTE_GROUPINGS),
LintId::of(&loops::EMPTY_LOOP),
LintId::of(&loops::FOR_KV_MAP),
LintId::of(&loops::NEEDLESS_RANGE_LOOP),

View file

@ -96,7 +96,7 @@ declare_clippy_lint! {
/// let x: u32 = 0xFFF_FFF;
/// let y: u8 = 0b01_011_101;
/// ```
pub UNUSUAL_BYTE_GROUPING,
pub UNUSUAL_BYTE_GROUPINGS,
style,
"binary or hex literals that aren't grouped by four"
}
@ -144,7 +144,7 @@ enum WarningType {
LargeDigitGroups,
DecimalRepresentation,
MistypedLiteralSuffix,
UnusualByteGrouping,
UnusualByteGroupings,
}
impl WarningType {
@ -195,9 +195,9 @@ impl WarningType {
suggested_format,
Applicability::MachineApplicable,
),
Self::UnusualByteGrouping => span_lint_and_sugg(
Self::UnusualByteGroupings => span_lint_and_sugg(
cx,
UNUSUAL_BYTE_GROUPING,
UNUSUAL_BYTE_GROUPINGS,
span,
"digits of hex or binary literal not grouped by four",
"consider",
@ -213,7 +213,7 @@ declare_lint_pass!(LiteralDigitGrouping => [
INCONSISTENT_DIGIT_GROUPING,
LARGE_DIGIT_GROUPS,
MISTYPED_LITERAL_SUFFIXES,
UNUSUAL_BYTE_GROUPING,
UNUSUAL_BYTE_GROUPINGS,
]);
impl EarlyLintPass for LiteralDigitGrouping {
@ -268,7 +268,7 @@ impl LiteralDigitGrouping {
let should_warn = match warning_type {
| WarningType::UnreadableLiteral
| WarningType::InconsistentDigitGrouping
| WarningType::UnusualByteGrouping
| WarningType::UnusualByteGroupings
| WarningType::LargeDigitGroups => {
!in_macro(lit.span)
}
@ -369,7 +369,7 @@ impl LiteralDigitGrouping {
let first = groups.next().expect("At least one group");
if (radix == Radix::Binary || radix == Radix::Hexadecimal) && groups.any(|i| i != 4 && i != 2) {
return Err(WarningType::UnusualByteGrouping);
return Err(WarningType::UnusualByteGroupings);
}
if let Some(second) = groups.next() {