aboutsummaryrefslogtreecommitdiff
path: root/docs/user/features.md
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-09 20:16:28 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-09 20:16:28 +0100
commitcc284dad30de4990516eeccf60f24e613fd78a2a (patch)
treeab1b62d318b44bec3706a30401d5b4213f8618a3 /docs/user/features.md
parent2fc2d4373b2c4e96bebf320a84270eee3afe34aa (diff)
parentc5f8f3b1f423781e09bb5f63e33d772ee59fab77 (diff)
Merge #1122
1122: Add explicit type assist. r=matklad a=marcogroppo This assist can be used to specify the explicit type in let statements. For example `let num = 1;` becomes `let num: i32 = 1;`. The assist is applicable only if the inferred type is fully known. Co-authored-by: Marco Groppo <[email protected]>
Diffstat (limited to 'docs/user/features.md')
-rw-r--r--docs/user/features.md32
1 files changed, 31 insertions, 1 deletions
diff --git a/docs/user/features.md b/docs/user/features.md
index 3ac99eef1..09a7f5a43 100644
--- a/docs/user/features.md
+++ b/docs/user/features.md
@@ -333,10 +333,40 @@ impl VariantData {
333```rust 333```rust
334// before: 334// before:
335use algo:<|>:visitor::{Visitor, visit}; 335use algo:<|>:visitor::{Visitor, visit};
336//after: 336// after:
337use algo::{<|>visitor::{Visitor, visit}}; 337use algo::{<|>visitor::{Visitor, visit}};
338``` 338```
339 339
340- Flip binary expression
341
342```rust
343// before:
344fn foo() {
345 if 1 <<|> 2 {
346 println!("Who would have thought?");
347 }
348}
349// after:
350fn foo() {
351 if 2 ><|> 1 {
352 println!("Who would have thought?");
353 }
354}
355```
356
357- Add explicit type
358
359```rust
360// before:
361fn foo() {
362 let t<|> = (&2, Some(1));
363}
364// after:
365fn foo() {
366 let t<|>: (&i32, Option<i32>) = (&2, Some(1));
367}
368```
369
340### Magic Completions 370### Magic Completions
341 371
342In addition to usual reference completion, rust-analyzer provides some ✨magic✨ 372In addition to usual reference completion, rust-analyzer provides some ✨magic✨