File tree Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -390,14 +390,14 @@ fn foo() {
390390
391391- Move guard expression to match arm body
392392``` rust
393- // before:
393+ // before:
394394fn f () {
395395 match x {
396396 <| >y @ 4 | y @ 5 if y > 5 => true ,
397397 _ => false
398398 }
399399}
400- // after:
400+ // after:
401401fn f () {
402402 match x {
403403 y @ 4 | y @ 5 => if y > 5 { <| >true },
@@ -406,6 +406,35 @@ fn f() {
406406}
407407```
408408
409+ - Move if condition to match arm guard
410+ ``` rust
411+ // before:
412+ fn f () {
413+ let mut t = 'a' ;
414+ let chars = " abcd" ;
415+ match t {
416+ '\ r ' => if let Some (_ ) = chars . clone (). next () {
417+ t = 'e' ;<| >
418+ false
419+ },
420+ _ => true
421+ }
422+ }
423+
424+ // after:
425+ fn f () {
426+ let mut t = 'a' ;
427+ let chars = " abcd" ;
428+ match t {
429+ '\ r ' <| >if let Some (_ ) = chars . clone (). next () => {
430+ t = 'e' ;
431+ false
432+ },
433+ _ => true
434+ }
435+ }
436+ ```
437+
409438### Magic Completions
410439
411440In addition to usual reference completion, rust-analyzer provides some ✨magic✨
You can’t perform that action at this time.
0 commit comments