From 55ffd09fe5ebdd0ed0c9b3421ca51c3fb430f5d1 Mon Sep 17 00:00:00 2001 From: code002lover Date: Wed, 17 Jul 2024 01:00:15 +0200 Subject: [PATCH] make some statics actually static --- src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0b1ced5..032b8c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -74,10 +74,10 @@ fn worker( try_set_thread_priority(); static INC: once_cell::sync::Lazy = Lazy::new(BigUint::one); - - let one_thousand = &BigUint::from(SPLITTER * 10); - let one_hundred = &BigUint::from(SPLITTER); - let ten = &BigUint::from(10u8); + static ONE_THOUSAND: once_cell::sync::Lazy = + Lazy::new(|| BigUint::from(SPLITTER * 10)); + static ONE_HUNDRED: once_cell::sync::Lazy = Lazy::new(|| BigUint::from(SPLITTER)); + static TEN: once_cell::sync::Lazy = Lazy::new(|| BigUint::from(10u8)); let work_uint = BigUint::from(workloads); let mut number = BigUint::from(i) * &work_uint; @@ -94,7 +94,7 @@ fn worker( progress.fetch_add(1, std::sync::atomic::Ordering::Relaxed); } - if (&number * one_thousand) / &max / ten == &number / &max * one_hundred { + if (&number * &*ONE_THOUSAND) / &max / &*TEN == &number / &max * &*ONE_HUNDRED { drop(global_primes); let mut new_primecache = arcclone.write().unwrap();