A first attempt to implement the Sieve of Eratosthenes to find all the prime numbers from 2 up to a given number resulted in this brute force algorithm. A user pointed out, that this is in fact not the Sieve of Eratosthenes, but just a brute force algorithm and should be reviewed as such.
#![feature(inclusive_range_syntax)]
pub fn primes_up_to(limit: u64) -> Vec<u64> {
let mut vec: Vec<u64> = (2...limit).collect::<Vec<_>>();
for p in 2...limit {
vec.retain(|&x| x <= p || x % p != 0);
}
vec
}