Skip to content

Commit 67a7502

Browse files
committed
Changelog rust-analyzer#59
1 parent b7c8ec1 commit 67a7502

File tree

6 files changed

+233
-131
lines changed

6 files changed

+233
-131
lines changed

generated_assists.adoc

Lines changed: 89 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl Trait for () {
7474
type X = ();
7575
fn foo(&self) {}
7676

77-
$0fn bar(&self) {}
77+
┃fn bar(&self) {}
7878
}
7979
```
8080

@@ -107,7 +107,7 @@ trait Trait<T> {
107107
}
108108

109109
impl Trait<u32> for () {
110-
$0type X;
110+
┃type X;
111111

112112
fn foo(&self) -> u32 {
113113
todo!()
@@ -280,58 +280,6 @@ fn qux(bar: Bar, baz: Baz) {}
280280
```
281281

282282

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-
335283
[discrete]
336284
=== `extract_struct_from_enum_variant`
337285
**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() {
367315
.After
368316
```rust
369317
fn main() {
370-
let $0var_name = (1 + 2);
318+
let ┃var_name = (1 + 2);
371319
var_name * 4;
372320
}
373321
```
@@ -396,7 +344,7 @@ enum Action { Move { distance: u32 }, Stop }
396344

397345
fn handle(action: Action) {
398346
match action {
399-
$0Action::Move { distance } => {}
347+
┃Action::Move { distance } => {}
400348
Action::Stop => {}
401349
}
402350
}
@@ -422,7 +370,7 @@ fn main() {
422370
.After
423371
```rust
424372
mod m {
425-
$0pub(crate) fn frobnicate() {}
373+
┃pub(crate) fn frobnicate() {}
426374
}
427375
fn main() {
428376
m::frobnicate() {}
@@ -536,7 +484,7 @@ struct Point {
536484

537485
.After
538486
```rust
539-
#[derive($0)]
487+
#[derive()]
540488
struct Point {
541489
x: u32,
542490
y: u32,
@@ -569,7 +517,7 @@ impl From<u32> for A {
569517

570518
[discrete]
571519
=== `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]
573521

574522
Adds a stub function with a signature matching the function under the cursor.
575523

@@ -618,7 +566,7 @@ struct Ctx<T: Clone> {
618566
}
619567

620568
impl<T: Clone> Ctx<T> {
621-
$0
569+
622570
}
623571
```
624572

@@ -643,7 +591,7 @@ struct Ctx<T: Clone> {
643591
}
644592

645593
impl<T: Clone> Ctx<T> {
646-
fn $0new(data: T) -> Self { Self { data } }
594+
fn ┃new(data: T) -> Self { Self { data } }
647595
}
648596

649597
```
@@ -667,6 +615,33 @@ fn foo() -> i32 { 42i32 }
667615
```
668616

669617

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+
670645
[discrete]
671646
=== `inline_local_variable`
672647
**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) {
917892
```
918893

919894

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+
920947
[discrete]
921948
=== `qualify_path`
922949
**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() {
12421269
let x: Result<i32, i32> = Result::Ok(92);
12431270
let y = match x {
12441271
Ok(a) => a,
1245-
$0_ => unreachable!(),
1272+
┃_ => unreachable!(),
12461273
};
12471274
}
12481275
```

0 commit comments

Comments
 (0)