You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnmain(){letmut x = 1;let y = (1..10).fold(0,move|acc, e| {
x *= e;// should warn: new value of `x` never read
acc + e
});println!("{} {}", x, y);// outputs: `1 45`}
It would be best if the compiler points out that "updating x inside the closure will not have an external effect." Though, I would be happy if the compiler at least pointed out that "the modified value in the new binding x is never read."