Skip to content

Commit 646f973

Browse files
committed
Auto merge of rust-lang#14134 - lnicola:clippy-manual, r=Veykril
feat: Add clippy configuration section to the manual and update some old keys Closes rust-lang#14132 I don't think this is supposed to be under `Diagnostics`, but it does make sense in a way 🤷 (it's probably where someone might look).
2 parents a14a152 + 8f617b5 commit 646f973

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docs/user/manual.adoc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,14 +773,18 @@ See https://github.com/rust-analyzer/rust-project.json-example for a small examp
773773

774774
You can set the `RA_LOG` environment variable to `rust_analyzer=info` to inspect how rust-analyzer handles config and project loading.
775775

776-
Note that calls to `cargo check` are disabled when using `rust-project.json` by default, so compilation errors and warnings will no longer be sent to your LSP client. To enable these compilation errors you will need to specify explicitly what command rust-analyzer should run to perform the checks using the `checkOnSave.overrideCommand` configuration. As an example, the following configuration explicitly sets `cargo check` as the `checkOnSave` command.
776+
Note that calls to `cargo check` are disabled when using `rust-project.json` by default, so compilation errors and warnings will no longer be sent to your LSP client.
777+
To enable these compilation errors you will need to specify explicitly what command rust-analyzer should run to perform the checks using the `rust-analyzer.check.overrideCommand` configuration.
778+
As an example, the following configuration explicitly sets `cargo check` as the `check` command.
777779

778780
[source,json]
779781
----
780-
{ "rust-analyzer.checkOnSave.overrideCommand": ["cargo", "check", "--message-format=json"] }
782+
{ "rust-analyzer.check.overrideCommand": ["cargo", "check", "--message-format=json"] }
781783
----
782784

783-
The `checkOnSave.overrideCommand` requires the command specified to output json error messages for rust-analyzer to consume. The `--message-format=json` flag does this for `cargo check` so whichever command you use must also output errors in this format. See the <<Configuration>> section for more information.
785+
`check.overrideCommand` requires the command specified to output json error messages for rust-analyzer to consume.
786+
The `--message-format=json` flag does this for `cargo check` so whichever command you use must also output errors in this format.
787+
See the <<Configuration>> section for more information.
784788

785789
== Security
786790

@@ -821,6 +825,10 @@ include::./generated_assists.adoc[]
821825
While most errors and warnings provided by rust-analyzer come from the `cargo check` integration, there's a growing number of diagnostics implemented using rust-analyzer's own analysis.
822826
Some of these diagnostics don't respect `\#[allow]` or `\#[deny]` attributes yet, but can be turned off using the `rust-analyzer.diagnostics.enable`, `rust-analyzer.diagnostics.experimental.enable` or `rust-analyzer.diagnostics.disabled` settings.
823827

828+
=== Clippy
829+
830+
To run `cargo clippy` instead of `cargo check`, you can set `"rust-analyzer.check.command": "clippy"`.
831+
824832
include::./generated_diagnostic.adoc[]
825833

826834
== Editor Features
@@ -953,7 +961,7 @@ Also note that a full runnable name is something like *run bin_or_example_name*,
953961

954962
Instead of relying on the built-in `cargo check`, you can configure Code to run a command in the background and use the `$rustc-watch` problem matcher to generate inline error markers from its output.
955963

956-
To do this you need to create a new https://code.visualstudio.com/docs/editor/tasks[VS Code Task] and set `rust-analyzer.checkOnSave.enable: false` in preferences.
964+
To do this you need to create a new https://code.visualstudio.com/docs/editor/tasks[VS Code Task] and set `"rust-analyzer.checkOnSave": false` in preferences.
957965

958966
For example, if you want to run https://crates.io/crates/cargo-watch[`cargo watch`] instead, you might add the following to `.vscode/tasks.json`:
959967

0 commit comments

Comments
 (0)