From 0dd35ff2b2ceffdb926953fdacc7d30e1968047d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Oct 2019 14:16:46 +0300 Subject: auto-generate assists docs and tests --- docs/user/assists.md | 24 ++++++++++++++++++++++++ docs/user/features.md | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 docs/user/assists.md (limited to 'docs') 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 @@ +# 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 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 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 -- cgit v1.2.3