Skip to content

Commit 6e09cba

Browse files
authored
Merge pull request uutils#5890 from kralo/fix-5884
factor: remove clippy exceptions by reformatting "unreadable literals"
2 parents ae5f2bc + 3eba957 commit 6e09cba

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

src/uu/factor/build.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
//! Generate a table of the multiplicative inverses of p_i mod 2^64
6+
//! Generate a table of the multiplicative inverses of `p_i` mod 2^64
77
//! for the first 1027 odd primes (all 13 bit and smaller primes).
88
//! You can supply a command line argument to override the default
99
//! value of 1027 for the number of entries in the table.
@@ -87,7 +87,7 @@ fn test_generator_10001() {
8787
}
8888

8989
const MAX_WIDTH: usize = 102;
90-
const PREAMBLE: &str = r##"/*
90+
const PREAMBLE: &str = r"/*
9191
* This file is part of the uutils coreutils package.
9292
*
9393
* For the full copyright and license information, please view the LICENSE file
@@ -100,4 +100,4 @@ const PREAMBLE: &str = r##"/*
100100
101101
#[allow(clippy::unreadable_literal)]
102102
pub const PRIME_INVERSIONS_U64: &[(u64, u64, u64)] = &[
103-
"##;
103+
";

src/uu/factor/src/factor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ mod tests {
217217
// This is a strong pseudoprime (wrt. miller_rabin::BASIS)
218218
// and triggered a bug in rho::factor's code path handling
219219
// miller_rabbin::Result::Composite
220-
let pseudoprime = 17179869183;
220+
let pseudoprime = 17_179_869_183;
221221
for _ in 0..20 {
222222
// Repeat the test 20 times, as it only fails some fraction
223223
// of the time.

src/uu/factor/src/miller_rabin.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@ pub(crate) trait Basis {
1414
impl Basis for Montgomery<u64> {
1515
// Small set of bases for the Miller-Rabin prime test, valid for all 64b integers;
1616
// discovered by Jim Sinclair on 2011-04-20, see miller-rabin.appspot.com
17-
#[allow(clippy::unreadable_literal)]
18-
const BASIS: &'static [u64] = &[2, 325, 9375, 28178, 450775, 9780504, 1795265022];
17+
const BASIS: &'static [u64] = &[2, 325, 9375, 28178, 450_775, 9_780_504, 1_795_265_022];
1918
}
2019

2120
impl Basis for Montgomery<u32> {
2221
// spell-checker:ignore (names) Steve Worley
2322
// Small set of bases for the Miller-Rabin prime test, valid for all 32b integers;
2423
// discovered by Steve Worley on 2013-05-27, see miller-rabin.appspot.com
25-
#[allow(clippy::unreadable_literal)]
2624
const BASIS: &'static [u64] = &[
27-
4230279247111683200,
28-
14694767155120705706,
29-
16641139526367750375,
25+
4_230_279_247_111_683_200,
26+
14_694_767_155_120_705_706,
27+
16_641_139_526_367_750_375,
3028
];
3129
}
3230

@@ -112,7 +110,7 @@ mod tests {
112110
use crate::numeric::{traits::DoubleInt, Arithmetic, Montgomery};
113111
use quickcheck::quickcheck;
114112
use std::iter;
115-
const LARGEST_U64_PRIME: u64 = 0xFFFFFFFFFFFFFFC5;
113+
const LARGEST_U64_PRIME: u64 = 0xFFFF_FFFF_FFFF_FFC5;
116114

117115
fn primes() -> impl Iterator<Item = u64> {
118116
iter::once(2).chain(odd_primes())

tests/by-util/test_factor.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
5-
#![allow(clippy::unreadable_literal)]
65

76
// spell-checker:ignore (methods) hexdigest
87

0 commit comments

Comments
 (0)