diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-25 12:50:06 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-25 12:50:06 +0100 |
commit | c48b467eff0e18f3b8fa1b65a21abb19f800f56a (patch) | |
tree | 47d48171346d25e357df7b15c012447756cf9b0b /docs/user | |
parent | 5f779f6c46f29c63483c0e2be732377b1b87e685 (diff) | |
parent | 0dd35ff2b2ceffdb926953fdacc7d30e1968047d (diff) |
Merge #2069
2069: auto-generate assists docs and tests r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'docs/user')
-rw-r--r-- | docs/user/assists.md | 24 | ||||
-rw-r--r-- | docs/user/features.md | 4 |
2 files changed, 27 insertions, 1 deletions
diff --git a/docs/user/assists.md b/docs/user/assists.md new file mode 100644 index 000000000..cb4b0b9fb --- /dev/null +++ b/docs/user/assists.md | |||
@@ -0,0 +1,24 @@ | |||
1 | # Assists | ||
2 | |||
3 | ## `convert_to_guarded_return` | ||
4 | |||
5 | Replace a large conditional with a guarded return. | ||
6 | |||
7 | ```rust | ||
8 | // BEFORE | ||
9 | fn main() { | ||
10 | <|>if cond { | ||
11 | foo(); | ||
12 | bar(); | ||
13 | } | ||
14 | } | ||
15 | |||
16 | // AFTER | ||
17 | fn main() { | ||
18 | if !cond { | ||
19 | return; | ||
20 | } | ||
21 | foo(); | ||
22 | bar(); | ||
23 | } | ||
24 | ``` | ||
diff --git a/docs/user/features.md b/docs/user/features.md index 8b7a8d7fc..a94b65ad4 100644 --- a/docs/user/features.md +++ b/docs/user/features.md | |||
@@ -97,11 +97,13 @@ Start `cargo watch` for live error highlighting. Will prompt to install if it's | |||
97 | 97 | ||
98 | Stop `cargo watch` | 98 | Stop `cargo watch` |
99 | 99 | ||
100 | ### Code Actions (Assists) | 100 | ### Assists (Code Actions) |
101 | 101 | ||
102 | These are triggered in a particular context via light bulb. We use custom code on | 102 | These are triggered in a particular context via light bulb. We use custom code on |
103 | the VS Code side to be able to position cursor. `<|>` signifies cursor | 103 | the VS Code side to be able to position cursor. `<|>` signifies cursor |
104 | 104 | ||
105 | See [assists.md](./assists.md) | ||
106 | |||
105 | - Add `#[derive]` | 107 | - Add `#[derive]` |
106 | 108 | ||
107 | ```rust | 109 | ```rust |