From 62d10ff578f9539c38c2e816ae64982a35b52e5c Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Thu, 25 Jul 2024 13:36:53 -0500 Subject: [PATCH] Small tweaks to get coverage up --- rust/src/main.rs | 1 + rust/src/p0009.rs | 5 ++--- rust/src/p0012.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/src/main.rs b/rust/src/main.rs index 5d70d851..1486f6c7 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -42,6 +42,7 @@ const ANSWERS: [ProblemRef; 17] = [ ("p0357", p0357::p0357, 1739023853137), ]; +#[cfg(not(test))] fn main() { let sieve = primes::primes::().take(10); for i in sieve { diff --git a/rust/src/p0009.rs b/rust/src/p0009.rs index 61ebfed8..0def6cbc 100644 --- a/rust/src/p0009.rs +++ b/rust/src/p0009.rs @@ -13,10 +13,9 @@ For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. */ -const MAX: u32 = 500; pub fn p0009() -> i128 { - for c in 3..MAX { + for c in 3.. { let c_square = c * c; for b in 2..c { let b_square = b * b; @@ -28,5 +27,5 @@ pub fn p0009() -> i128 { } } } - return 0; + unreachable!(); } diff --git a/rust/src/p0012.rs b/rust/src/p0012.rs index 461b61a8..5977cffc 100644 --- a/rust/src/p0012.rs +++ b/rust/src/p0012.rs @@ -37,5 +37,5 @@ pub fn p0012() -> i128 { return num.into(); } } - return -1; + unreachable!(); }