Why would mut
not be required here
#[allow(dead_code)]
fn addo2(v: Vec<u64>, oi: Option<u64>) -> Vec<u64> {
oi.into_iter().fold(v, |mut v, i| add(v, i)) //warning: variable does not need to be mutable
}
#[allow(dead_code)]
fn add(mut v: Vec<u64>, i: u64) -> Vec<u64> {
v.push(i);
v
}
when it is, as expected, required in this code
fn addo(v: Vec<u64>, oi: Option<u64>) -> Vec<u64> {
oi.into_iter().fold(v, |mut v, i| {
v.push(i);
v
})
}