Update on how to use Clippy in VSCode with rust-analyzer

I followed the guidance provided here:

But I couldn't make Clippy work with the rust-analyzer VSCode extension. There are errors that I get in the terminal but which do not show up in the VSCode UI.

Here are my settings:

"rust-analyzer.check.command": "clippy",
"rust-analyzer.check.extraArgs": [
  "-- -D warnings"
],
"rust-analyzer.checkOnSave": true,

I've already restarted VSCode. What am I missing and why does Clippy not work?

Environment:

  • macOS Sonoma v14.0
  • VSCode v1.84.2

Nevermind. The problem was that my local VSCode settings (in ./.vscode) were overriding the global user settings on my machine.

1 Like

By the way, why are you setting -D warnings? That just converts all warnings into errors, which won't affect rust-analyzer's operation, and at worst might cause you to get fewer warnings (because an error cancels checking of crates dependent on the crate with an error).

I haven't tried this myself so I might be missing something, but it seems unnecessary.

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.