aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/lsp-extensions.md18
-rw-r--r--docs/dev/style.md25
-rw-r--r--docs/user/generated_config.adoc2
3 files changed, 41 insertions, 4 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index dd3ecc18d..694fafcd5 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -1,5 +1,5 @@
1<!--- 1<!---
2lsp_ext.rs hash: d279d971d4f62cd7 2lsp_ext.rs hash: 4dfa8d7035f4aee7
3 3
4If you need to change the above hash to make the test pass, please check if you 4If you need to change the above hash to make the test pass, please check if you
5need to adjust this doc as well and ping this issue: 5need to adjust this doc as well and ping this issue:
@@ -579,3 +579,19 @@ This request is sent from client to server to open the current project's Cargo.t
579``` 579```
580 580
581`experimental/openCargoToml` returns a single `Link` to the start of the `[package]` keyword. 581`experimental/openCargoToml` returns a single `Link` to the start of the `[package]` keyword.
582
583## Related tests
584
585This request is sent from client to server to get the list of tests for the specified position.
586
587**Method:** `rust-analyzer/relatedTests`
588
589**Request:** `TextDocumentPositionParams`
590
591**Response:** `TestInfo[]`
592
593```typescript
594interface TestInfo {
595 runnable: Runnable;
596}
597```
diff --git a/docs/dev/style.md b/docs/dev/style.md
index 46bd8b9b2..e4a1672ca 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -91,8 +91,8 @@ But many users read changelogs.
91We don't enforce Clippy. 91We don't enforce Clippy.
92A number of default lints have high false positive rate. 92A number of default lints have high false positive rate.
93Selectively patching false-positives with `allow(clippy)` is considered worse than not using Clippy at all. 93Selectively patching false-positives with `allow(clippy)` is considered worse than not using Clippy at all.
94There's `cargo xtask lint` command which runs a subset of low-FPR lints. 94There's a `cargo lint` command which runs a subset of low-FPR lints.
95Careful tweaking of `xtask lint` is welcome. 95Careful tweaking of `lint` is welcome.
96Of course, applying Clippy suggestions is welcome as long as they indeed improve the code. 96Of course, applying Clippy suggestions is welcome as long as they indeed improve the code.
97 97
98**Rationale:** see [rust-lang/clippy#5537](https://github.com/rust-lang/rust-clippy/issues/5537). 98**Rationale:** see [rust-lang/clippy#5537](https://github.com/rust-lang/rust-clippy/issues/5537).
@@ -787,6 +787,27 @@ assert!(0 > x);
787 787
788**Rationale:** Less-then comparisons are more intuitive, they correspond spatially to [real line](https://en.wikipedia.org/wiki/Real_line). 788**Rationale:** Less-then comparisons are more intuitive, they correspond spatially to [real line](https://en.wikipedia.org/wiki/Real_line).
789 789
790## If-let
791
792Avoid `if let ... { } else { }` construct, use `match` instead.
793
794```rust
795// GOOD
796match ctx.expected_type.as_ref() {
797 Some(expected_type) => completion_ty == expected_type && !expected_type.is_unit(),
798 None => false,
799}
800
801// BAD
802if let Some(expected_type) = ctx.expected_type.as_ref() {
803 completion_ty == expected_type && !expected_type.is_unit()
804} else {
805 false
806}
807```
808
809**Rational:** `match` is almost always more compact.
810The `else` branch can get a more precise pattern: `None` or `Err(_)` instead of `_`.
790 811
791## Token names 812## Token names
792 813
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index 042ba2d54..c2521289c 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -276,7 +276,7 @@ Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
276-- 276--
277Whether to show `can't find Cargo.toml` error message. 277Whether to show `can't find Cargo.toml` error message.
278-- 278--
279[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `false`):: 279[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `true`)::
280+ 280+
281-- 281--
282Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`. 282Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.