@@ -726,6 +726,41 @@ fn qux(bar: Bar, baz: Baz) {}
726
726
```
727
727
728
728
729
+ [discrete]
730
+ === `extract_expressions_from_format_string`
731
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/extract_expressions_from_format_string.rs#L13[extract_expressions_from_format_string.rs]
732
+
733
+ Move an expression out of a format string.
734
+
735
+ .Before
736
+ ```rust
737
+ macro_rules! format_args {
738
+ ($lit:literal $(tt:tt)*) => { 0 },
739
+ }
740
+ macro_rules! print {
741
+ ($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
742
+ }
743
+
744
+ fn main() {
745
+ print!("{var} {x + 1}┃");
746
+ }
747
+ ```
748
+
749
+ .After
750
+ ```rust
751
+ macro_rules! format_args {
752
+ ($lit:literal $(tt:tt)*) => { 0 },
753
+ }
754
+ macro_rules! print {
755
+ ($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
756
+ }
757
+
758
+ fn main() {
759
+ print!("{var} {}"┃, x + 1);
760
+ }
761
+ ```
762
+
763
+
729
764
[discrete]
730
765
=== `extract_function`
731
766
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/extract_function.rs#L38[extract_function.rs]
@@ -812,7 +847,7 @@ enum A { One(One) }
812
847
813
848
[discrete]
814
849
=== `extract_type_alias`
815
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/extract_type_alias.rs#L10 [extract_type_alias.rs]
850
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/extract_type_alias.rs#L7 [extract_type_alias.rs]
816
851
817
852
Extracts the selected type as a type alias.
818
853
@@ -1325,7 +1360,7 @@ fn main() {
1325
1360
1326
1361
[discrete]
1327
1362
=== `generate_from_impl_for_enum`
1328
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs#L6 [generate_from_impl_for_enum.rs]
1363
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/generate_from_impl_for_enum.rs#L8 [generate_from_impl_for_enum.rs]
1329
1364
1330
1365
Adds a From impl for this enum variant with one tuple field.
1331
1366
@@ -1661,6 +1696,43 @@ fn main() {
1661
1696
```
1662
1697
1663
1698
1699
+ [discrete]
1700
+ === `inline_macro`
1701
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/inline_macro.rs#L5[inline_macro.rs]
1702
+
1703
+ Takes a macro and inlines it one step.
1704
+
1705
+ .Before
1706
+ ```rust
1707
+ macro_rules! num {
1708
+ (+$($t:tt)+) => (1 + num!($($t )+));
1709
+ (-$($t:tt)+) => (-1 + num!($($t )+));
1710
+ (+) => (1);
1711
+ (-) => (-1);
1712
+ }
1713
+
1714
+ fn main() {
1715
+ let number = num┃!(+ + + - + +);
1716
+ println!("{number}");
1717
+ }
1718
+ ```
1719
+
1720
+ .After
1721
+ ```rust
1722
+ macro_rules! num {
1723
+ (+$($t:tt)+) => (1 + num!($($t )+));
1724
+ (-$($t:tt)+) => (-1 + num!($($t )+));
1725
+ (+) => (1);
1726
+ (-) => (-1);
1727
+ }
1728
+
1729
+ fn main() {
1730
+ let number = 1+num!(+ + - + +);
1731
+ println!("{number}");
1732
+ }
1733
+ ```
1734
+
1735
+
1664
1736
[discrete]
1665
1737
=== `inline_type_alias`
1666
1738
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/inline_type_alias.rs#L105[inline_type_alias.rs]
@@ -1980,41 +2052,6 @@ impl S {
1980
2052
```
1981
2053
1982
2054
1983
- [discrete]
1984
- === `move_format_string_arg`
1985
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/move_format_string_arg.rs#L13[move_format_string_arg.rs]
1986
-
1987
- Move an expression out of a format string.
1988
-
1989
- .Before
1990
- ```rust
1991
- macro_rules! format_args {
1992
- ($lit:literal $(tt:tt)*) => { 0 },
1993
- }
1994
- macro_rules! print {
1995
- ($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
1996
- }
1997
-
1998
- fn main() {
1999
- print!("{x + 1}┃");
2000
- }
2001
- ```
2002
-
2003
- .After
2004
- ```rust
2005
- macro_rules! format_args {
2006
- ($lit:literal $(tt:tt)*) => { 0 },
2007
- }
2008
- macro_rules! print {
2009
- ($($arg:tt)*) => (std::io::_print(format_args!($($arg)*)));
2010
- }
2011
-
2012
- fn main() {
2013
- print!("{}"┃, x + 1);
2014
- }
2015
- ```
2016
-
2017
-
2018
2055
[discrete]
2019
2056
=== `move_from_mod_rs`
2020
2057
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/move_from_mod_rs.rs#L12[move_from_mod_rs.rs]
@@ -2412,6 +2449,69 @@ impl Foo for Bar {
2412
2449
```
2413
2450
2414
2451
2452
+ [discrete]
2453
+ === `replace_arith_with_checked`
2454
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_arith_op.rs#L9[replace_arith_op.rs]
2455
+
2456
+ Replaces arithmetic on integers with the `checked_*` equivalent.
2457
+
2458
+ .Before
2459
+ ```rust
2460
+ fn main() {
2461
+ let x = 1 ┃+ 2;
2462
+ }
2463
+ ```
2464
+
2465
+ .After
2466
+ ```rust
2467
+ fn main() {
2468
+ let x = 1.checked_add(2);
2469
+ }
2470
+ ```
2471
+
2472
+
2473
+ [discrete]
2474
+ === `replace_arith_with_saturating`
2475
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_arith_op.rs#L28[replace_arith_op.rs]
2476
+
2477
+ Replaces arithmetic on integers with the `saturating_*` equivalent.
2478
+
2479
+ .Before
2480
+ ```rust
2481
+ fn main() {
2482
+ let x = 1 ┃+ 2;
2483
+ }
2484
+ ```
2485
+
2486
+ .After
2487
+ ```rust
2488
+ fn main() {
2489
+ let x = 1.saturating_add(2);
2490
+ }
2491
+ ```
2492
+
2493
+
2494
+ [discrete]
2495
+ === `replace_arith_with_wrapping`
2496
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_arith_op.rs#L50[replace_arith_op.rs]
2497
+
2498
+ Replaces arithmetic on integers with the `wrapping_*` equivalent.
2499
+
2500
+ .Before
2501
+ ```rust
2502
+ fn main() {
2503
+ let x = 1 ┃+ 2;
2504
+ }
2505
+ ```
2506
+
2507
+ .After
2508
+ ```rust
2509
+ fn main() {
2510
+ let x = 1.wrapping_add(2);
2511
+ }
2512
+ ```
2513
+
2514
+
2415
2515
[discrete]
2416
2516
=== `replace_char_with_string`
2417
2517
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_string_with_char.rs#L51[replace_string_with_char.rs]
@@ -2884,6 +2984,27 @@ pub async fn bar() { foo() }
2884
2984
```
2885
2985
2886
2986
2987
+ [discrete]
2988
+ === `unqualify_method_call`
2989
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/unqualify_method_call.rs#L8[unqualify_method_call.rs]
2990
+
2991
+ Transforms universal function call syntax into a method call.
2992
+
2993
+ .Before
2994
+ ```rust
2995
+ fn main() {
2996
+ std::ops::Add::add┃(1, 2);
2997
+ }
2998
+ ```
2999
+
3000
+ .After
3001
+ ```rust
3002
+ fn main() {
3003
+ 1.add(2);
3004
+ }
3005
+ ```
3006
+
3007
+
2887
3008
[discrete]
2888
3009
=== `unwrap_block`
2889
3010
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/unwrap_block.rs#L11[unwrap_block.rs]
0 commit comments