diff options
Diffstat (limited to 'docs/user/assists.md')
-rw-r--r-- | docs/user/assists.md | 24 |
1 files changed, 24 insertions, 0 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 | ``` | ||