diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-26 17:12:17 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-26 17:12:17 +0100 |
commit | 568ef921acb8d35eed434089c1b1947c585c3f4c (patch) | |
tree | a3dfa55e7fadcb7e7e8299ce03d9f7beaee4a79b /docs/user | |
parent | 2f7d1f10c1614d9448604da5c105b75c43cc6f2b (diff) | |
parent | a5cbd8d5e8aca0d0d8dde175ba13bfa995a753c0 (diff) |
Merge #2077
2077: check style for assist docs r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'docs/user')
-rw-r--r-- | docs/user/assists.md | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/docs/user/assists.md b/docs/user/assists.md index 603b29c66..8e2e8cc94 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md | |||
@@ -21,7 +21,7 @@ struct Point { | |||
21 | 21 | ||
22 | ## `add_explicit_type` | 22 | ## `add_explicit_type` |
23 | 23 | ||
24 | Specify type for a let binding | 24 | Specify type for a let binding. |
25 | 25 | ||
26 | ```rust | 26 | ```rust |
27 | // BEFORE | 27 | // BEFORE |
@@ -37,7 +37,7 @@ fn main() { | |||
37 | 37 | ||
38 | ## `add_impl` | 38 | ## `add_impl` |
39 | 39 | ||
40 | Adds a new inherent impl for a type | 40 | Adds a new inherent impl for a type. |
41 | 41 | ||
42 | ```rust | 42 | ```rust |
43 | // BEFORE | 43 | // BEFORE |
@@ -57,7 +57,7 @@ impl<T: Clone> Ctx<T> { | |||
57 | 57 | ||
58 | ## `add_impl_default_members` | 58 | ## `add_impl_default_members` |
59 | 59 | ||
60 | Adds scaffold for overriding default impl members | 60 | Adds scaffold for overriding default impl members. |
61 | 61 | ||
62 | ```rust | 62 | ```rust |
63 | // BEFORE | 63 | // BEFORE |
@@ -90,7 +90,7 @@ impl T for () { | |||
90 | 90 | ||
91 | ## `add_impl_missing_members` | 91 | ## `add_impl_missing_members` |
92 | 92 | ||
93 | Adds scaffold for required impl members | 93 | Adds scaffold for required impl members. |
94 | 94 | ||
95 | ```rust | 95 | ```rust |
96 | // BEFORE | 96 | // BEFORE |
@@ -196,3 +196,52 @@ fn handle(action: Action) { | |||
196 | } | 196 | } |
197 | } | 197 | } |
198 | ``` | 198 | ``` |
199 | |||
200 | ## `flip_binexpr` | ||
201 | |||
202 | Flips operands of a binary expression. | ||
203 | |||
204 | ```rust | ||
205 | // BEFORE | ||
206 | fn main() { | ||
207 | let _ = 90 +<|> 2; | ||
208 | } | ||
209 | |||
210 | // AFTER | ||
211 | fn main() { | ||
212 | let _ = 2 + 90; | ||
213 | } | ||
214 | ``` | ||
215 | |||
216 | ## `flip_comma` | ||
217 | |||
218 | Flips two comma-separated items. | ||
219 | |||
220 | ```rust | ||
221 | // BEFORE | ||
222 | fn main() { | ||
223 | ((1, 2),<|> (3, 4)); | ||
224 | } | ||
225 | |||
226 | // AFTER | ||
227 | fn main() { | ||
228 | ((3, 4), (1, 2)); | ||
229 | } | ||
230 | ``` | ||
231 | |||
232 | ## `inline_local_variable` | ||
233 | |||
234 | Inlines local variable. | ||
235 | |||
236 | ```rust | ||
237 | // BEFORE | ||
238 | fn main() { | ||
239 | let x<|> = 1 + 2; | ||
240 | x * 4; | ||
241 | } | ||
242 | |||
243 | // AFTER | ||
244 | fn main() { | ||
245 | (1 + 2) * 4; | ||
246 | } | ||
247 | ``` | ||