Is it possible to run rust analyzer to not just display but outright inject variable types on variable declarations?
Say in this case
The linter is displaying the type, I would like it to inject the characters instead of just showing them.
Is it possible to run rust analyzer to not just display but outright inject variable types on variable declarations?
Say in this case
The linter is displaying the type, I would like it to inject the characters instead of just showing them.
It can't, because it's out of scope. Adding the type would mean changing the file, and that's not rust-analyzer's job. rust-analyzer extracts the necessary type information, and whatever editor/IDE you use has to provide the feature of actually adding it.
Here's an example of me using Helix's source-actions menu (Space+a) to add the type:
(Conceptually, rather than rust-analyzer, it'd be cargo clippy --fix
that could be used for changing files, but I haven't found a lint like that and suspect it's not implemented.)