@@ -62,7 +62,6 @@ pub(crate) fn unwrap_block(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
62
62
let range_to_del_else_if = TextRange :: new( ancestor_then_branch. syntax( ) . text_range( ) . end( ) , l_curly_token. text_range( ) . start( ) ) ;
63
63
let range_to_del_rest = TextRange :: new( then_branch. syntax( ) . text_range( ) . end( ) , if_expr. syntax( ) . text_range( ) . end( ) ) ;
64
64
65
- edit. set_cursor( ancestor_then_branch. syntax( ) . text_range( ) . end( ) ) ;
66
65
edit. delete( range_to_del_rest) ;
67
66
edit. delete( range_to_del_else_if) ;
68
67
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<()>
79
78
return acc. add( assist_id, assist_label, target, |edit| {
80
79
let range_to_del = TextRange :: new( then_branch. syntax( ) . text_range( ) . end( ) , l_curly_token. text_range( ) . start( ) ) ;
81
80
82
- edit. set_cursor( then_branch. syntax( ) . text_range( ) . end( ) ) ;
83
81
edit. delete( range_to_del) ;
84
82
edit. replace( target, update_expr_string( else_block. to_string( ) , & [ ' ' , '{' ] ) ) ;
85
83
} ) ;
@@ -97,8 +95,6 @@ pub(crate) fn unwrap_block(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
97
95
98
96
let target = expr_to_unwrap. syntax ( ) . text_range ( ) ;
99
97
acc. add ( assist_id, assist_label, target, |edit| {
100
- edit. set_cursor ( expr. syntax ( ) . text_range ( ) . start ( ) ) ;
101
-
102
98
edit. replace (
103
99
expr. syntax ( ) . text_range ( ) ,
104
100
update_expr_string ( expr_to_unwrap. to_string ( ) , & [ ' ' , '{' , '\n' ] ) ,
@@ -154,7 +150,7 @@ mod tests {
154
150
r#"
155
151
fn main() {
156
152
bar();
157
- <|> foo();
153
+ foo();
158
154
159
155
//comment
160
156
bar();
@@ -188,7 +184,7 @@ mod tests {
188
184
189
185
//comment
190
186
bar();
191
- }<|>
187
+ }
192
188
println!("bar");
193
189
}
194
190
"# ,
@@ -222,7 +218,7 @@ mod tests {
222
218
223
219
//comment
224
220
//bar();
225
- }<|>
221
+ }
226
222
println!("bar");
227
223
}
228
224
"# ,
@@ -258,7 +254,7 @@ mod tests {
258
254
//bar();
259
255
} else if false {
260
256
println!("bar");
261
- }<|>
257
+ }
262
258
println!("foo");
263
259
}
264
260
"# ,
@@ -298,7 +294,7 @@ mod tests {
298
294
println!("bar");
299
295
} else if true {
300
296
println!("foo");
301
- }<|>
297
+ }
302
298
println!("else");
303
299
}
304
300
"# ,
@@ -336,7 +332,7 @@ mod tests {
336
332
//bar();
337
333
} else if false {
338
334
println!("bar");
339
- }<|>
335
+ }
340
336
println!("foo");
341
337
}
342
338
"# ,
@@ -383,7 +379,7 @@ mod tests {
383
379
"# ,
384
380
r#"
385
381
fn main() {
386
- <|> if true {
382
+ if true {
387
383
foo();
388
384
389
385
//comment
@@ -417,7 +413,7 @@ mod tests {
417
413
r#"
418
414
fn main() {
419
415
for i in 0..5 {
420
- <|> foo();
416
+ foo();
421
417
422
418
//comment
423
419
bar();
@@ -447,7 +443,7 @@ mod tests {
447
443
"# ,
448
444
r#"
449
445
fn main() {
450
- <|> if true {
446
+ if true {
451
447
foo();
452
448
453
449
//comment
@@ -480,7 +476,7 @@ mod tests {
480
476
"# ,
481
477
r#"
482
478
fn main() {
483
- <|> if true {
479
+ if true {
484
480
foo();
485
481
486
482
//comment
0 commit comments