Encuentra números primos con el tamiz de Eratosthenes

fn sieve(in_n: u32) -> Vec<u32> {
    let n = in_n as usize;
    let mut a = Vec::new();
    a.resize(n, true);
    for i in 2..(f64::sqrt(n as f64) as usize + 1) {
        if a[i] {
            for j in (i*i..n).step_by(i) {
                a[j] = false;
            }
        }
    }
    return a.iter().enumerate().filter_map(|(i, &t)| {
      if t {Some(i as u32)} else {None}   
    }).collect();
}

fn main() {
    let n = 12;
    println!("List of primes less than {} = {:?} ", n, sieve(n));
}
Mackerel