diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2019-10-25 14:16:46 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2019-10-25 14:47:48 +0300 |
| commit | 0dd35ff2b2ceffdb926953fdacc7d30e1968047d (patch) | |
| tree | a8bcab00ef1c434e56845034f22a5595d119dea7 /docs/user | |
| parent | 518f99e16b993e3414a81181c8bad7a89e590ece (diff) | |
| download | rust-0dd35ff2b2ceffdb926953fdacc7d30e1968047d.tar.gz rust-0dd35ff2b2ceffdb926953fdacc7d30e1968047d.zip | |
auto-generate assists docs and tests
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 00000000000..cb4b0b9fb83 --- /dev/null +++ b/docs/user/assists.md @@ -0,0 +1,24 @@ +# Assists + +## `convert_to_guarded_return` + +Replace a large conditional with a guarded return. + +```rust +// BEFORE +fn main() { + <|>if cond { + foo(); + bar(); + } +} + +// AFTER +fn main() { + if !cond { + return; + } + foo(); + bar(); +} +``` diff --git a/docs/user/features.md b/docs/user/features.md index 8b7a8d7fc18..a94b65ad4da 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 Stop `cargo watch` -### Code Actions (Assists) +### Assists (Code Actions) These are triggered in a particular context via light bulb. We use custom code on the VS Code side to be able to position cursor. `<|>` signifies cursor +See [assists.md](./assists.md) + - Add `#[derive]` ```rust |
