@@ -141,7 +141,7 @@ struct Point<'a> {
141
141
142
142
[discrete]
143
143
=== `add_missing_match_arms`
144
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/add_missing_match_arms.rs#L16 [add_missing_match_arms.rs]
144
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/add_missing_match_arms.rs#L15 [add_missing_match_arms.rs]
145
145
146
146
Adds missing clauses to a `match` expression.
147
147
@@ -612,6 +612,38 @@ fn ┃fun_name(n: i32) {
612
612
```
613
613
614
614
615
+ [discrete]
616
+ === `extract_module`
617
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_module.rs#L25[extract_module.rs]
618
+
619
+ Extracts a selected region as seperate module. All the references, visibility and imports are
620
+ resolved.
621
+
622
+ .Before
623
+ ```rust
624
+ ┃fn foo(name: i32) -> i32 {
625
+ name + 1
626
+ }┃
627
+
628
+ fn bar(name: i32) -> i32 {
629
+ name + 2
630
+ }
631
+ ```
632
+
633
+ .After
634
+ ```rust
635
+ mod modname {
636
+ pub(crate) fn foo(name: i32) -> i32 {
637
+ name + 1
638
+ }
639
+ }
640
+
641
+ fn bar(name: i32) -> i32 {
642
+ name + 2
643
+ }
644
+ ```
645
+
646
+
615
647
[discrete]
616
648
=== `extract_struct_from_enum_variant`
617
649
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs#L29[extract_struct_from_enum_variant.rs]
@@ -1075,7 +1107,7 @@ impl From<u32> for A {
1075
1107
1076
1108
[discrete]
1077
1109
=== `generate_function`
1078
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_function.rs#L25 [generate_function.rs]
1110
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_function.rs#L27 [generate_function.rs]
1079
1111
1080
1112
Adds a stub function with a signature matching the function under the cursor.
1081
1113
@@ -1126,15 +1158,15 @@ struct Person {
1126
1158
impl Person {
1127
1159
/// Get a reference to the person's name.
1128
1160
fn ┃name(&self) -> &str {
1129
- self.name.as_str ()
1161
+ self.name.as_ref ()
1130
1162
}
1131
1163
}
1132
1164
```
1133
1165
1134
1166
1135
1167
[discrete]
1136
1168
=== `generate_getter_mut`
1137
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_getter.rs#L36 [generate_getter.rs]
1169
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_getter.rs#L51 [generate_getter.rs]
1138
1170
1139
1171
Generate a mut getter method.
1140
1172
@@ -1753,6 +1785,37 @@ fn main() {
1753
1785
```
1754
1786
1755
1787
1788
+ [discrete]
1789
+ === `qualify_method_call`
1790
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/qualify_method_call.rs#L13[qualify_method_call.rs]
1791
+
1792
+ Replaces the method call with a qualified function call.
1793
+
1794
+ .Before
1795
+ ```rust
1796
+ struct Foo;
1797
+ impl Foo {
1798
+ fn foo(&self) {}
1799
+ }
1800
+ fn main() {
1801
+ let foo = Foo;
1802
+ foo.fo┃o();
1803
+ }
1804
+ ```
1805
+
1806
+ .After
1807
+ ```rust
1808
+ struct Foo;
1809
+ impl Foo {
1810
+ fn foo(&self) {}
1811
+ }
1812
+ fn main() {
1813
+ let foo = Foo;
1814
+ Foo::foo(&foo);
1815
+ }
1816
+ ```
1817
+
1818
+
1756
1819
[discrete]
1757
1820
=== `qualify_path`
1758
1821
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/qualify_path.rs#L21[qualify_path.rs]
@@ -2300,7 +2363,7 @@ fn foo() {
2300
2363
2301
2364
[discrete]
2302
2365
=== `unwrap_result_return_type`
2303
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/unwrap_result_return_type.rs#L9 [unwrap_result_return_type.rs]
2366
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/unwrap_result_return_type.rs#L10 [unwrap_result_return_type.rs]
2304
2367
2305
2368
Unwrap the function's return type.
2306
2369
0 commit comments