When I type this in VSCode:
let mut guess = String::new();
I see it changed to:
let mut guess: String = String::new();
Why is this happening?
When I type this in VSCode:
let mut guess = String::new();
I see it changed to:
let mut guess: String = String::new();
Why is this happening?
These are called inlay hints. rust-analyzer shows you the inferred type of the variable so you know it, for easier code reading. VSCode does not actually change the code, just how it displays it.
If you don't like it, you can turn it off by setting rust-analyzer.inlayHints.typeHints.enable
to false
. This disables only this kind of inlay hints; there are many others you can control via the settings from the group rust-analyzer.inlayHints
.