]> git.lizzy.rs Git - rust.git/commitdiff
Allow hex literals to pass w/ groups of 2
authorcgm616 <cgm616@me.com>
Sun, 25 Oct 2020 13:18:06 +0000 (09:18 -0400)
committercgm616 <cgm616@me.com>
Sun, 25 Oct 2020 13:18:38 +0000 (09:18 -0400)
clippy_lints/src/literal_representation.rs

index b41cfe32cfead4f9ea1cffdbbfa93f57d4dcebd8..813f3b6f378949540dacac1197fb80c76c8fa782 100644 (file)
@@ -368,7 +368,7 @@ fn get_group_size<'a>(groups: impl Iterator<Item = &'a str>, radix: Radix) -> Re
 
         let first = groups.next().expect("At least one group");
 
-        if (radix == Radix::Binary || radix == Radix::Hexadecimal) && groups.any(|i| i % 4 != 0) {
+        if (radix == Radix::Binary || radix == Radix::Hexadecimal) && groups.any(|i| i != 4 || i != 2) {
             return Err(WarningType::UnusualByteGrouping);
         }