diff --git a/rust/src/primes.rs b/rust/src/primes.rs index d41a277c..f67f44c4 100644 --- a/rust/src/primes.rs +++ b/rust/src/primes.rs @@ -40,7 +40,7 @@ impl Iterator for Eratosthenes { fn next_prime(sieve: &mut HashMap>, candidate: u64) -> u64 { match sieve.get(&candidate) { Some(numbers) => { - for num in numbers { + for num in numbers.to_owned() { sieve .entry(candidate + num) .and_modify(|v| v.push(num))