performance – Function returning a vec with prime factors of number

See code below and my comment with questions:

pub fn factors(n: u64) -> Vec<u64> {
    let mut m = n; // is it possible to convert n to a mutable type without using another variable?
    let mut a:Vec<u64> = Vec::new();
    while m % 2 == 0 {
        a.push(2);
    }
    // in C we can just write for (int i = 3; i <= sqrt(m); i+= 2) ... just saying... and C is not even as fast as python to code... am I really doing it right??
    for i in (3..((m as f64).sqrt() as usize + 1usize)).step_by(2) { 
        while m % i as u64 == 0 { // is there a way to avoid all the casts to u64
            a.push(i as u64);
            m /= i as u64;
        }
    }
    if m > 2 {
        a.push(m);
    }
    return a;
}
  • Is it possible to convert n to a mutable type without using another variable?
  • The C equivalent of the main loop use twice less ink. Is Rust so verbose by design?
  • Is there a way to avoid all the casts to u64
  • any other insight welcome