Open
Description
I tried this code:
fn t(n: &mut i32) {
n = "42".parse().unwrap();
}
I expected to see this happen: Suggestion of *n = ...
, the correct code would be
fn t(n: &mut i32) {
*n = "42".parse().unwrap();
}
Instead, this happened: It did not look at mutable deref value and directly show the suggestion
error[E0277]: the trait bound `&mut i32: std::str::FromStr` is not satisfied
--> src/lib.rs:2:14
|
2 | n = "42".parse().unwrap();
| ^^^^^ the trait `std::str::FromStr` is not implemented for `&mut i32`
|
= help: the following implementations were found:
<i32 as std::str::FromStr>
Not sure why but I miss *
quite often. Link to playground https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=011e594936166764d011c581d7db107e
Meta
rustc --version --verbose
:
1.42.0