Skip to content

Commit d0ecb66

Browse files
fix: rename SimpleRng::next to next_u64 to avoid Iterator::next clash
The name `next` conflicts with Iterator::next and triggers clippy's should_implement_trait lint. Use next_u64 which accurately reflects the u64 return type and avoids the naming collision. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ed86817 commit d0ecb66

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/kyron/src/time/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,15 @@ mod tests {
562562
}
563563

564564
// Linear Congruential Generator (LCG)
565-
fn next(&mut self) -> u64 {
565+
fn next_u64(&mut self) -> u64 {
566566
// Constants from Numerical Recipes
567567
self.state = self.state.wrapping_mul(6364136223846793005).wrapping_add(1);
568568
self.state >> 32
569569
}
570570

571571
/// Generates a random number in the range [0, max)
572572
fn gen_range(&mut self, max: u64) -> u64 {
573-
self.next() % max
573+
self.next_u64() % max
574574
}
575575
}
576576

@@ -625,7 +625,7 @@ mod tests {
625625
let current = timeouts[i];
626626
let next = timeouts[i + 1];
627627

628-
let before = prev + rng.next() % (current - prev);
628+
let before = prev + rng.next_u64() % (current - prev);
629629

630630
driver.process_internal(before);
631631
assert_eq!(
@@ -647,7 +647,7 @@ mod tests {
647647
current
648648
); // Shall fire
649649

650-
let after = current + rng.next() % (next - current);
650+
let after = current + rng.next_u64() % (next - current);
651651
driver.process_internal(after);
652652
assert_eq!(
653653
current_call_times,

0 commit comments

Comments
 (0)