From 8bdd28e455d161734b4c5071c1d86d6454e14375 Mon Sep 17 00:00:00 2001 From: Gulshan Yadav Date: Mon, 2 Feb 2026 01:28:26 +0530 Subject: [PATCH] fix: replace all unstable is_multiple_of with modulo operator Rust's is_multiple_of is an unstable feature (issue #128101). Replace with standard modulo operator for compatibility with stable Rust. --- apps/synord/src/main.rs | 4 ++-- crates/synor-mining/src/kheavyhash.rs | 2 +- crates/synor-mining/src/miner.rs | 2 +- crates/synor-storage/src/chunker.rs | 2 +- crates/synor-storage/src/proof.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/synord/src/main.rs b/apps/synord/src/main.rs index ec5c7e0..de4a957 100644 --- a/apps/synord/src/main.rs +++ b/apps/synord/src/main.rs @@ -494,7 +494,7 @@ async fn import_blocks( errors += 1; } else { imported += 1; - if imported.is_multiple_of(1000) { + if imported % 1000 == 0 { info!("Imported {} blocks...", imported); } } @@ -586,7 +586,7 @@ async fn export_blocks( writer.write_all(&serialized)?; exported += 1; - if exported.is_multiple_of(1000) { + if exported % 1000 == 0 { info!("Exported {} blocks...", exported); } } diff --git a/crates/synor-mining/src/kheavyhash.rs b/crates/synor-mining/src/kheavyhash.rs index d9da83c..b3c8882 100644 --- a/crates/synor-mining/src/kheavyhash.rs +++ b/crates/synor-mining/src/kheavyhash.rs @@ -166,7 +166,7 @@ impl KHeavyHash { } // Report progress every 10000 hashes - if tried.is_multiple_of(10000) && !callback(tried, nonce) { + if tried % 10000 == 0 && !callback(tried, nonce) { return None; // Cancelled } } diff --git a/crates/synor-mining/src/miner.rs b/crates/synor-mining/src/miner.rs index aea2bc8..2f58f82 100644 --- a/crates/synor-mining/src/miner.rs +++ b/crates/synor-mining/src/miner.rs @@ -282,7 +282,7 @@ impl BlockMiner { nonce = nonce.wrapping_add(1); // Update stats periodically - if hashes.is_multiple_of(10000) { + if hashes % 10000 == 0 { self.hash_counter.fetch_add(10000, Ordering::Relaxed); } } diff --git a/crates/synor-storage/src/chunker.rs b/crates/synor-storage/src/chunker.rs index da481a9..4c6206b 100644 --- a/crates/synor-storage/src/chunker.rs +++ b/crates/synor-storage/src/chunker.rs @@ -139,7 +139,7 @@ impl Chunker { pub fn chunk_count(&self, file_size: u64) -> u32 { let size = file_size as usize; let full_chunks = size / self.config.chunk_size; - let has_remainder = !size.is_multiple_of(self.config.chunk_size); + let has_remainder = size % self.config.chunk_size != 0; (full_chunks + if has_remainder { 1 } else { 0 }) as u32 } diff --git a/crates/synor-storage/src/proof.rs b/crates/synor-storage/src/proof.rs index deefe0b..ee703fa 100644 --- a/crates/synor-storage/src/proof.rs +++ b/crates/synor-storage/src/proof.rs @@ -187,7 +187,7 @@ impl MerkleTree { let mut level_size = self.leaf_count; while level_size > 1 { - let sibling_idx = if idx.is_multiple_of(2) { + let sibling_idx = if idx % 2 == 0 { idx + 1 } else { idx - 1