Why does reassigning a mutable String results in compile error? Shouldn't mut
allow mutating string?
fn main() {
let mut guess = String::from("foo\n");
guess = guess.trim();
println!("Input: {}", guess);
}
Gives
9 | guess = guess.trim();
| ^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
| |
| expected struct `String`, found `&str`