aboutsummaryrefslogtreecommitdiff
path: root/docs/user
diff options
context:
space:
mode:
Diffstat (limited to 'docs/user')
-rw-r--r--docs/user/README.md2
-rw-r--r--docs/user/features.md33
2 files changed, 32 insertions, 3 deletions
diff --git a/docs/user/README.md b/docs/user/README.md
index 1b4d13d0f..affb96939 100644
--- a/docs/user/README.md
+++ b/docs/user/README.md
@@ -64,7 +64,7 @@ for details.
64* `rust-analyzer.showWorkspaceLoadedNotification`: to ease troubleshooting, a 64* `rust-analyzer.showWorkspaceLoadedNotification`: to ease troubleshooting, a
65 notification is shown by default when a workspace is loaded 65 notification is shown by default when a workspace is loaded
66* `rust-analyzer.enableEnhancedTyping`: by default, rust-analyzer intercepts 66* `rust-analyzer.enableEnhancedTyping`: by default, rust-analyzer intercepts
67 `Enter` key to make it easier to continue comments 67 `Enter` key to make it easier to continue comments. Note that it may conflict with VIM emulation plugin.
68* `rust-analyzer.raLspServerPath`: path to `ra_lsp_server` executable 68* `rust-analyzer.raLspServerPath`: path to `ra_lsp_server` executable
69* `rust-analyzer.enableCargoWatchOnStartup`: prompt to install & enable `cargo 69* `rust-analyzer.enableCargoWatchOnStartup`: prompt to install & enable `cargo
70 watch` for live error highlighting (note, this **does not** use rust-analyzer) 70 watch` for live error highlighting (note, this **does not** use rust-analyzer)
diff --git a/docs/user/features.md b/docs/user/features.md
index a714574fb..22470bc56 100644
--- a/docs/user/features.md
+++ b/docs/user/features.md
@@ -390,14 +390,14 @@ fn foo() {
390 390
391- Move guard expression to match arm body 391- Move guard expression to match arm body
392```rust 392```rust
393//before: 393// before:
394fn f() { 394fn f() {
395 match x { 395 match x {
396 <|>y @ 4 | y @ 5 if y > 5 => true, 396 <|>y @ 4 | y @ 5 if y > 5 => true,
397 _ => false 397 _ => false
398 } 398 }
399} 399}
400//after: 400// after:
401fn f() { 401fn f() {
402 match x { 402 match x {
403 y @ 4 | y @ 5 => if y > 5 { <|>true }, 403 y @ 4 | y @ 5 => if y > 5 { <|>true },
@@ -406,6 +406,35 @@ fn f() {
406} 406}
407``` 407```
408 408
409- Move if condition to match arm guard
410```rust
411// before:
412fn f() {
413 let mut t = 'a';
414 let chars = "abcd";
415 match t {
416 '\r' => if chars.clone().next().is_some() {
417 t = 'e';<|>
418 false
419 },
420 _ => true
421 }
422}
423
424// after:
425fn f() {
426 let mut t = 'a';
427 let chars = "abcd";
428 match t {
429 '\r' <|>if chars.clone().next().is_some() => {
430 t = 'e';
431 false
432 },
433 _ => true
434 }
435}
436```
437
409### Magic Completions 438### Magic Completions
410 439
411In addition to usual reference completion, rust-analyzer provides some ✨magic✨ 440In addition to usual reference completion, rust-analyzer provides some ✨magic✨