@@ -62,7 +62,6 @@ pub(crate) fn unwrap_block(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
6262 let range_to_del_else_if = TextRange :: new( ancestor_then_branch. syntax( ) . text_range( ) . end( ) , l_curly_token. text_range( ) . start( ) ) ;
6363 let range_to_del_rest = TextRange :: new( then_branch. syntax( ) . text_range( ) . end( ) , if_expr. syntax( ) . text_range( ) . end( ) ) ;
6464
65- edit. set_cursor( ancestor_then_branch. syntax( ) . text_range( ) . end( ) ) ;
6665 edit. delete( range_to_del_rest) ;
6766 edit. delete( range_to_del_else_if) ;
6867 edit. replace( target, update_expr_string( then_branch. to_string( ) , & [ ' ' , '{' ] ) ) ;
@@ -79,7 +78,6 @@ pub(crate) fn unwrap_block(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
7978 return acc. add( assist_id, assist_label, target, |edit| {
8079 let range_to_del = TextRange :: new( then_branch. syntax( ) . text_range( ) . end( ) , l_curly_token. text_range( ) . start( ) ) ;
8180
82- edit. set_cursor( then_branch. syntax( ) . text_range( ) . end( ) ) ;
8381 edit. delete( range_to_del) ;
8482 edit. replace( target, update_expr_string( else_block. to_string( ) , & [ ' ' , '{' ] ) ) ;
8583 } ) ;
@@ -97,8 +95,6 @@ pub(crate) fn unwrap_block(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
9795
9896 let target = expr_to_unwrap. syntax ( ) . text_range ( ) ;
9997 acc. add ( assist_id, assist_label, target, |edit| {
100- edit. set_cursor ( expr. syntax ( ) . text_range ( ) . start ( ) ) ;
101-
10298 edit. replace (
10399 expr. syntax ( ) . text_range ( ) ,
104100 update_expr_string ( expr_to_unwrap. to_string ( ) , & [ ' ' , '{' , '\n' ] ) ,
@@ -154,7 +150,7 @@ mod tests {
154150 r#"
155151 fn main() {
156152 bar();
157- <|> foo();
153+ foo();
158154
159155 //comment
160156 bar();
@@ -188,7 +184,7 @@ mod tests {
188184
189185 //comment
190186 bar();
191- }<|>
187+ }
192188 println!("bar");
193189 }
194190 "# ,
@@ -222,7 +218,7 @@ mod tests {
222218
223219 //comment
224220 //bar();
225- }<|>
221+ }
226222 println!("bar");
227223 }
228224 "# ,
@@ -258,7 +254,7 @@ mod tests {
258254 //bar();
259255 } else if false {
260256 println!("bar");
261- }<|>
257+ }
262258 println!("foo");
263259 }
264260 "# ,
@@ -298,7 +294,7 @@ mod tests {
298294 println!("bar");
299295 } else if true {
300296 println!("foo");
301- }<|>
297+ }
302298 println!("else");
303299 }
304300 "# ,
@@ -336,7 +332,7 @@ mod tests {
336332 //bar();
337333 } else if false {
338334 println!("bar");
339- }<|>
335+ }
340336 println!("foo");
341337 }
342338 "# ,
@@ -383,7 +379,7 @@ mod tests {
383379 "# ,
384380 r#"
385381 fn main() {
386- <|> if true {
382+ if true {
387383 foo();
388384
389385 //comment
@@ -417,7 +413,7 @@ mod tests {
417413 r#"
418414 fn main() {
419415 for i in 0..5 {
420- <|> foo();
416+ foo();
421417
422418 //comment
423419 bar();
@@ -447,7 +443,7 @@ mod tests {
447443 "# ,
448444 r#"
449445 fn main() {
450- <|> if true {
446+ if true {
451447 foo();
452448
453449 //comment
@@ -480,7 +476,7 @@ mod tests {
480476 "# ,
481477 r#"
482478 fn main() {
483- <|> if true {
479+ if true {
484480 foo();
485481
486482 //comment
0 commit comments