I'm using rust-analyzer with the rust-tools.nvim plugins in neovim. I have set up rust-analyzer to have diagnostics coming from clippy, but when there is a fix, it is not suggested in code actions as fixes from cargo check do. Is there a way to do that ?
- Make sure you already set
check.command
toclippy
in RA config. - Not every diagnostic has its clippy fix suggestion. Try out the following snippet showing
clippy::approx_constant
andclippy::manual_filter_map
diagnostics. [1]
fn main() {
let _ = 3.14; // diagnostic without an action
let _ = (1i32..10) // diagnostic with actions
.filter(|n| n.checked_add(1).is_some())
.map(|n| n.checked_add(1).unwrap());
}
-
If clippy is not set properly, diagnostics and actions won't show up. ↩︎
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.