diff options
| author | bors <bors@rust-lang.org> | 2023-02-12 09:53:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-12 09:53:15 +0000 |
| commit | 646f97385709fab31db2f10661125c0bbbda6b7c (patch) | |
| tree | 56cadef961f16a94aeee7df07cfd482aa6b6667b | |
| parent | a14a1520a3c1aba4d4b6139a7cac87f15ea84dd7 (diff) | |
| parent | 8f617b55cefb199f80b114a37215d51e380d6ebf (diff) | |
| download | rust-646f97385709fab31db2f10661125c0bbbda6b7c.tar.gz rust-646f97385709fab31db2f10661125c0bbbda6b7c.zip | |
Auto merge of #14134 - lnicola:clippy-manual, r=Veykril
feat: Add clippy configuration section to the manual and update some old keys Closes #14132 I don't think this is supposed to be under `Diagnostics`, but it does make sense in a way :shrug: (it's probably where someone might look).
| -rw-r--r-- | docs/user/manual.adoc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index e3add3053b5..cb96feeb5e5 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc @@ -773,14 +773,18 @@ See https://github.com/rust-analyzer/rust-project.json-example for a small examp You can set the `RA_LOG` environment variable to `rust_analyzer=info` to inspect how rust-analyzer handles config and project loading. -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. +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 `rust-analyzer.check.overrideCommand` configuration. +As an example, the following configuration explicitly sets `cargo check` as the `check` command. [source,json] ---- -{ "rust-analyzer.checkOnSave.overrideCommand": ["cargo", "check", "--message-format=json"] } +{ "rust-analyzer.check.overrideCommand": ["cargo", "check", "--message-format=json"] } ---- -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. +`check.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. == Security @@ -821,6 +825,10 @@ include::./generated_assists.adoc[] 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. 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. +=== Clippy + +To run `cargo clippy` instead of `cargo check`, you can set `"rust-analyzer.check.command": "clippy"`. + include::./generated_diagnostic.adoc[] == Editor Features @@ -953,7 +961,7 @@ Also note that a full runnable name is something like *run bin_or_example_name*, 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. -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. +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. 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`: |
