@@ -74,7 +74,7 @@ impl Trait for () {
74
74
type X = ();
75
75
fn foo(&self) {}
76
76
77
- $0fn bar(&self) {}
77
+ ┃fn bar(&self) {}
78
78
}
79
79
```
80
80
@@ -107,7 +107,7 @@ trait Trait<T> {
107
107
}
108
108
109
109
impl Trait<u32> for () {
110
- $0type X;
110
+ ┃type X;
111
111
112
112
fn foo(&self) -> u32 {
113
113
todo!()
@@ -280,58 +280,6 @@ fn qux(bar: Bar, baz: Baz) {}
280
280
```
281
281
282
282
283
- [discrete]
284
- === `extract_assignment`
285
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/extract_assignment.rs#L12[extract_assignment.rs]
286
-
287
- Extracts variable assigment to outside an if or match statement.
288
-
289
- .Before
290
- ```rust
291
- fn main() {
292
- let mut foo = 6;
293
-
294
- if true {
295
- ┃foo = 5;
296
- } else {
297
- foo = 4;
298
- }
299
- }
300
- ```
301
-
302
- .After
303
- ```rust
304
- fn main() {
305
- let mut foo = 6;
306
-
307
- foo = if true {
308
- 5
309
- } else {
310
- 4
311
- };
312
- }
313
- ```
314
-
315
-
316
- [discrete]
317
- === `extract_module_to_file`
318
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/extract_module_to_file.rs#L10[extract_module_to_file.rs]
319
-
320
- This assist extract module to file.
321
-
322
- .Before
323
- ```rust
324
- mod foo {┃
325
- fn t() {}
326
- }
327
- ```
328
-
329
- .After
330
- ```rust
331
- mod foo;
332
- ```
333
-
334
-
335
283
[discrete]
336
284
=== `extract_struct_from_enum_variant`
337
285
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/extract_struct_from_enum_variant.rs#L19[extract_struct_from_enum_variant.rs]
@@ -367,7 +315,7 @@ fn main() {
367
315
.After
368
316
```rust
369
317
fn main() {
370
- let $0var_name = (1 + 2);
318
+ let ┃var_name = (1 + 2);
371
319
var_name * 4;
372
320
}
373
321
```
@@ -396,7 +344,7 @@ enum Action { Move { distance: u32 }, Stop }
396
344
397
345
fn handle(action: Action) {
398
346
match action {
399
- $0Action ::Move { distance } => {}
347
+ ┃Action ::Move { distance } => {}
400
348
Action::Stop => {}
401
349
}
402
350
}
@@ -422,7 +370,7 @@ fn main() {
422
370
.After
423
371
```rust
424
372
mod m {
425
- $0pub (crate) fn frobnicate() {}
373
+ ┃pub (crate) fn frobnicate() {}
426
374
}
427
375
fn main() {
428
376
m::frobnicate() {}
@@ -536,7 +484,7 @@ struct Point {
536
484
537
485
.After
538
486
```rust
539
- #[derive($0 )]
487
+ #[derive(┃ )]
540
488
struct Point {
541
489
x: u32,
542
490
y: u32,
@@ -569,7 +517,7 @@ impl From<u32> for A {
569
517
570
518
[discrete]
571
519
=== `generate_function`
572
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/generate_function.rs#L19 [generate_function.rs]
520
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/generate_function.rs#L18 [generate_function.rs]
573
521
574
522
Adds a stub function with a signature matching the function under the cursor.
575
523
@@ -618,7 +566,7 @@ struct Ctx<T: Clone> {
618
566
}
619
567
620
568
impl<T: Clone> Ctx<T> {
621
- $0
569
+ ┃
622
570
}
623
571
```
624
572
@@ -643,7 +591,7 @@ struct Ctx<T: Clone> {
643
591
}
644
592
645
593
impl<T: Clone> Ctx<T> {
646
- fn $0new (data: T) -> Self { Self { data } }
594
+ fn ┃new (data: T) -> Self { Self { data } }
647
595
}
648
596
649
597
```
@@ -667,6 +615,33 @@ fn foo() -> i32 { 42i32 }
667
615
```
668
616
669
617
618
+ [discrete]
619
+ === `inline_function`
620
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/inline_function.rs#L14[inline_function.rs]
621
+
622
+ Inlines a function body.
623
+
624
+ .Before
625
+ ```rust
626
+ fn add(a: u32, b: u32) -> u32 { a + b }
627
+ fn main() {
628
+ let x = add┃(1, 2);
629
+ }
630
+ ```
631
+
632
+ .After
633
+ ```rust
634
+ fn add(a: u32, b: u32) -> u32 { a + b }
635
+ fn main() {
636
+ let x = {
637
+ let a = 1;
638
+ let b = 2;
639
+ a + b
640
+ };
641
+ }
642
+ ```
643
+
644
+
670
645
[discrete]
671
646
=== `inline_local_variable`
672
647
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/inline_local_variable.rs#L13[inline_local_variable.rs]
@@ -917,6 +892,58 @@ fn handle(action: Action) {
917
892
```
918
893
919
894
895
+ [discrete]
896
+ === `move_module_to_file`
897
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/move_module_to_file.rs#L11[move_module_to_file.rs]
898
+
899
+ Moves inline module's contents to a separate file.
900
+
901
+ .Before
902
+ ```rust
903
+ mod ┃foo {
904
+ fn t() {}
905
+ }
906
+ ```
907
+
908
+ .After
909
+ ```rust
910
+ mod foo;
911
+ ```
912
+
913
+
914
+ [discrete]
915
+ === `pull_assignment_up`
916
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/pull_assignment_up.rs#L12[pull_assignment_up.rs]
917
+
918
+ Extracts variable assignment to outside an if or match statement.
919
+
920
+ .Before
921
+ ```rust
922
+ fn main() {
923
+ let mut foo = 6;
924
+
925
+ if true {
926
+ ┃foo = 5;
927
+ } else {
928
+ foo = 4;
929
+ }
930
+ }
931
+ ```
932
+
933
+ .After
934
+ ```rust
935
+ fn main() {
936
+ let mut foo = 6;
937
+
938
+ foo = if true {
939
+ 5
940
+ } else {
941
+ 4
942
+ };
943
+ }
944
+ ```
945
+
946
+
920
947
[discrete]
921
948
=== `qualify_path`
922
949
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/assists/src/handlers/qualify_path.rs#L19[qualify_path.rs]
@@ -1242,7 +1269,7 @@ fn main() {
1242
1269
let x: Result<i32, i32> = Result::Ok(92);
1243
1270
let y = match x {
1244
1271
Ok(a) => a,
1245
- $0_ => unreachable!(),
1272
+ ┃_ => unreachable!(),
1246
1273
};
1247
1274
}
1248
1275
```
0 commit comments