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/assists.md | |
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/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 | ``` | ||