diff options
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 |
