diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-25 19:46:40 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-25 19:46:40 +0000 |
commit | bb77bc5c2f6c6b9681d9b3d0a068791db7eec0e2 (patch) | |
tree | 492354c80a182257889af6d5301827573a039f51 /docs/user/features.md | |
parent | d88a96bd05fdfdc6986e7807c93400af2cf6fa0f (diff) | |
parent | 8cb3041a0cbd64b7ddc46fbf81a3c0088af7bcf2 (diff) |
Merge #1049
1049: Add description & example for inlining local variable r=matklad a=gfreezy
Co-authored-by: gfreezy <[email protected]>
Diffstat (limited to 'docs/user/features.md')
-rw-r--r-- | docs/user/features.md | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/docs/user/features.md b/docs/user/features.md index b9d2aa84f..7173d88e9 100644 --- a/docs/user/features.md +++ b/docs/user/features.md | |||
@@ -210,7 +210,7 @@ fn main() { | |||
210 | } | 210 | } |
211 | ``` | 211 | ``` |
212 | 212 | ||
213 | -- Fill struct fields | 213 | - Fill struct fields |
214 | 214 | ||
215 | ```rust | 215 | ```rust |
216 | // before: | 216 | // before: |
@@ -270,7 +270,22 @@ fn foo() { | |||
270 | } | 270 | } |
271 | ``` | 271 | ``` |
272 | 272 | ||
273 | -- Remove `dbg!` | 273 | - Inline local variable: |
274 | |||
275 | ```rust | ||
276 | // before: | ||
277 | fn foo() { | ||
278 | let a<|> = 1 + 1; | ||
279 | let b = a * 10; | ||
280 | } | ||
281 | |||
282 | // after: | ||
283 | fn foo() { | ||
284 | let b = (1 + 1) * 10; | ||
285 | } | ||
286 | ``` | ||
287 | |||
288 | - Remove `dbg!` | ||
274 | 289 | ||
275 | ```rust | 290 | ```rust |
276 | // before: | 291 | // before: |