@@ -550,6 +550,30 @@ impl Point {
550550```
551551
552552
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+
553577[discrete]
554578=== `convert_while_to_loop`
555579**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) {
23412365```
23422366
23432367
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+
23442414[discrete]
23452415=== `replace_qualified_name_with_use`
23462416**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() {
24072477
24082478[discrete]
24092479=== `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]
24112481
24122482Converts `::<_>` to an explicit type assignment.
24132483
@@ -2561,6 +2631,36 @@ fn arithmetics {
25612631```
25622632
25632633
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+
25642664[discrete]
25652665=== `unmerge_use`
25662666**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