Skip to content

Commit f96a01b

Browse files
committed
Add guard support for replace_if_let_with_match
- Fix loses comments - Fix bad indentation Example --- ```rust fn main() { if $0let true = true && true && false { code() } } ``` **Before this PR** Assist not applicable **After this PR** ```rust fn main() { match true { true if true && false => code(), _ => (), } } ``` --- ```rust pub fn foo(foo: i32) { $0if let 1 = foo { // some comment self.foo(); } else if let 2 = foo { // some comment 2 self.bar() } } ``` **Before this PR** ```rust pub fn foo(foo: i32) { match foo { 1 => { self.foo(); } 2 => self.bar(), _ => (), } } ``` **After this PR** ```rust pub fn foo(foo: i32) { match foo { 1 => { // some comment self.foo(); } 2 => { // some comment 2 self.bar() }, _ => (), } } ```
1 parent c46279d commit f96a01b

File tree

2 files changed

+382
-64
lines changed

2 files changed

+382
-64
lines changed

0 commit comments

Comments
 (0)