@@ -550,6 +550,30 @@ impl Point {
550
550
```
551
551
552
552
553
+ [discrete]
554
+ === `convert_two_arm_bool_match_to_matches_macro`
555
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/convert_two_arm_bool_match_to_matches_macro.rs#L5[convert_two_arm_bool_match_to_matches_macro.rs]
556
+
557
+ Convert 2-arm match that evaluates to a boolean into the equivalent matches! invocation.
558
+
559
+ .Before
560
+ ```rust
561
+ fn main() {
562
+ match scrutinee┃ {
563
+ Some(val) if val.cond() => true,
564
+ _ => false,
565
+ }
566
+ }
567
+ ```
568
+
569
+ .After
570
+ ```rust
571
+ fn main() {
572
+ matches!(scrutinee, Some(val) if val.cond())
573
+ }
574
+ ```
575
+
576
+
553
577
[discrete]
554
578
=== `convert_while_to_loop`
555
579
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/convert_while_to_loop.rs#L19[convert_while_to_loop.rs]
@@ -2341,6 +2365,52 @@ fn handle(action: Action) {
2341
2365
```
2342
2366
2343
2367
2368
+ [discrete]
2369
+ === `replace_or_else_with_or`
2370
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_or_with_or_else.rs#L89[replace_or_with_or_else.rs]
2371
+
2372
+ Replace `unwrap_or_else` with `unwrap_or` and `ok_or_else` with `ok_or`.
2373
+
2374
+ .Before
2375
+ ```rust
2376
+ fn foo() {
2377
+ let a = Some(1);
2378
+ a.unwra┃p_or_else(|| 2);
2379
+ }
2380
+ ```
2381
+
2382
+ .After
2383
+ ```rust
2384
+ fn foo() {
2385
+ let a = Some(1);
2386
+ a.unwrap_or(2);
2387
+ }
2388
+ ```
2389
+
2390
+
2391
+ [discrete]
2392
+ === `replace_or_with_or_else`
2393
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_or_with_or_else.rs#L12[replace_or_with_or_else.rs]
2394
+
2395
+ Replace `unwrap_or` with `unwrap_or_else` and `ok_or` with `ok_or_else`.
2396
+
2397
+ .Before
2398
+ ```rust
2399
+ fn foo() {
2400
+ let a = Some(1);
2401
+ a.unwra┃p_or(2);
2402
+ }
2403
+ ```
2404
+
2405
+ .After
2406
+ ```rust
2407
+ fn foo() {
2408
+ let a = Some(1);
2409
+ a.unwrap_or_else(|| 2);
2410
+ }
2411
+ ```
2412
+
2413
+
2344
2414
[discrete]
2345
2415
=== `replace_qualified_name_with_use`
2346
2416
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_qualified_name_with_use.rs#L13[replace_qualified_name_with_use.rs]
@@ -2407,7 +2477,7 @@ fn handle() {
2407
2477
2408
2478
[discrete]
2409
2479
=== `replace_turbofish_with_explicit_type`
2410
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_turbofish_with_explicit_type.rs#L12 [replace_turbofish_with_explicit_type.rs]
2480
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/replace_turbofish_with_explicit_type.rs#L13 [replace_turbofish_with_explicit_type.rs]
2411
2481
2412
2482
Converts `::<_>` to an explicit type assignment.
2413
2483
@@ -2561,6 +2631,36 @@ fn arithmetics {
2561
2631
```
2562
2632
2563
2633
2634
+ [discrete]
2635
+ === `unmerge_match_arm`
2636
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/unmerge_match_arm.rs#L10[unmerge_match_arm.rs]
2637
+
2638
+ Splits the current match with a `|` pattern into two arms with identical bodies.
2639
+
2640
+ .Before
2641
+ ```rust
2642
+ enum Action { Move { distance: u32 }, Stop }
2643
+
2644
+ fn handle(action: Action) {
2645
+ match action {
2646
+ Action::Move(..) ┃| Action::Stop => foo(),
2647
+ }
2648
+ }
2649
+ ```
2650
+
2651
+ .After
2652
+ ```rust
2653
+ enum Action { Move { distance: u32 }, Stop }
2654
+
2655
+ fn handle(action: Action) {
2656
+ match action {
2657
+ Action::Move(..) => foo(),
2658
+ Action::Stop => foo(),
2659
+ }
2660
+ }
2661
+ ```
2662
+
2663
+
2564
2664
[discrete]
2565
2665
=== `unmerge_use`
2566
2666
**Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-assists/src/handlers/unmerge_use.rs#L12[unmerge_use.rs]
0 commit comments