@@ -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#L15 [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#L16 [add_missing_match_arms.rs]
145
145
146
146
Adds missing clauses to a `match` expression.
147
147
@@ -583,7 +583,7 @@ fn qux(bar: Bar, baz: Baz) {}
583
583
584
584
[discrete]
585
585
=== `extract_function`
586
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_function.rs#L33 [extract_function.rs]
586
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/extract_function.rs#L38 [extract_function.rs]
587
587
588
588
Extracts selected statements into new function.
589
589
@@ -854,6 +854,47 @@ impl Default for Example {
854
854
```
855
855
856
856
857
+ [discrete]
858
+ === `generate_delegate_methods`
859
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_delegate_methods.rs#L10[generate_delegate_methods.rs]
860
+
861
+ Generate delegate methods.
862
+
863
+ .Before
864
+ ```rust
865
+ struct Age(u8);
866
+ impl Age {
867
+ fn age(&self) -> u8 {
868
+ self.0
869
+ }
870
+ }
871
+
872
+ struct Person {
873
+ ag┃e: Age,
874
+ }
875
+ ```
876
+
877
+ .After
878
+ ```rust
879
+ struct Age(u8);
880
+ impl Age {
881
+ fn age(&self) -> u8 {
882
+ self.0
883
+ }
884
+ }
885
+
886
+ struct Person {
887
+ age: Age,
888
+ }
889
+
890
+ impl Person {
891
+ ┃fn age(&self) -> u8 {
892
+ self.age.age()
893
+ }
894
+ }
895
+ ```
896
+
897
+
857
898
[discrete]
858
899
=== `generate_deref`
859
900
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/generate_deref.rs#L15[generate_deref.rs]
@@ -1645,6 +1686,40 @@ fn t() {}
1645
1686
```
1646
1687
1647
1688
1689
+ [discrete]
1690
+ === `promote_local_to_const`
1691
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/promote_local_to_const.rs#L19[promote_local_to_const.rs]
1692
+
1693
+ Promotes a local variable to a const item changing its name to a `SCREAMING_SNAKE_CASE` variant
1694
+ if the local uses no non-const expressions.
1695
+
1696
+ .Before
1697
+ ```rust
1698
+ fn main() {
1699
+ let foo┃ = true;
1700
+
1701
+ if foo {
1702
+ println!("It's true");
1703
+ } else {
1704
+ println!("It's false");
1705
+ }
1706
+ }
1707
+ ```
1708
+
1709
+ .After
1710
+ ```rust
1711
+ fn main() {
1712
+ const ┃FOO: bool = true;
1713
+
1714
+ if FOO {
1715
+ println!("It's true");
1716
+ } else {
1717
+ println!("It's false");
1718
+ }
1719
+ }
1720
+ ```
1721
+
1722
+
1648
1723
[discrete]
1649
1724
=== `pull_assignment_up`
1650
1725
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/pull_assignment_up.rs#L11[pull_assignment_up.rs]
@@ -1955,7 +2030,7 @@ fn compute() -> Option<i32> { None }
1955
2030
1956
2031
[discrete]
1957
2032
=== `replace_match_with_if_let`
1958
- **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_if_let_with_match.rs#L158 [replace_if_let_with_match.rs]
2033
+ **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_if_let_with_match.rs#L160 [replace_if_let_with_match.rs]
1959
2034
1960
2035
Replaces a binary `match` with a wildcard pattern and no guards with an `if let` expression.
1961
2036
@@ -2223,6 +2298,23 @@ fn foo() {
2223
2298
```
2224
2299
2225
2300
2301
+ [discrete]
2302
+ === `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]
2304
+
2305
+ Unwrap the function's return type.
2306
+
2307
+ .Before
2308
+ ```rust
2309
+ fn foo() -> Result<i32>┃ { Ok(42i32) }
2310
+ ```
2311
+
2312
+ .After
2313
+ ```rust
2314
+ fn foo() -> i32 { 42i32 }
2315
+ ```
2316
+
2317
+
2226
2318
[discrete]
2227
2319
=== `wrap_return_type_in_result`
2228
2320
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/wrap_return_type_in_result.rs#L11[wrap_return_type_in_result.rs]
0 commit comments