From 9d992b77b2840b4846e68700aff2c36d4ca24dbc Mon Sep 17 00:00:00 2001 From: nicoo Date: Sat, 20 Jun 2020 21:53:22 +0200 Subject: [PATCH] factor: Keep the primes table size in a single place --- src/uu/factor/build.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/uu/factor/build.rs b/src/uu/factor/build.rs index 1677e44eb..a045d66e6 100644 --- a/src/uu/factor/build.rs +++ b/src/uu/factor/build.rs @@ -39,12 +39,11 @@ fn main() { let mut file = File::create(&Path::new(&out_dir).join("prime_table.rs")).unwrap(); // By default, we print the multiplicative inverses mod 2^64 of the first 1k primes + const DEFAULT_SIZE: usize = 1027; let n = args() .nth(1) - .unwrap_or_else(|| "1027".to_string()) - .parse::() - .ok() - .unwrap_or(1027); + .and_then(|s| s.parse::().ok()) + .unwrap_or(DEFAULT_SIZE); write!(file, "{}", PREAMBLE).unwrap(); let mut cols = 3;