Skip to content

Commit d745ccd

Browse files
committed
Changelog #145
1 parent dcc158f commit d745ccd

File tree

3 files changed

+145
-2
lines changed

3 files changed

+145
-2
lines changed

generated_assists.adoc

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

24122482
Converts `::<_>` 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]

thisweek/_posts/2022-08-29-changelog-144.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ image::https://user-images.githubusercontent.com/308347/187130565-0a0f0d88-2036-
2727

2828
== Internal Improvements
2929

30-
* pr:13078[] (first contribution) remove unnecessary stream writer `try_clone` in `lsp-server`.
30+
* pr:13078[] (first contribution) remove unnecessary writer `try_clone` in `lsp-server`.
3131
* pr:13087[] remove automatic config patching from the VS Code extension.
3232
* pr:13116[] use identity hashing for `FileId` and `CrateId`.
3333
* pr:13101[] re-export standard semantic token types and modifiers.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
= Changelog #145
2+
:sectanchors:
3+
:page-layout: post
4+
5+
Commit: commit:67920f797511c360b25dab4d30730be304848f32[] +
6+
Release: release:2022-09-05[]
7+
8+
== New Features
9+
10+
* pr:13005[] (first contribution) add `Convert match to matches!` assist:
11+
+
12+
video::https://user-images.githubusercontent.com/308347/188391531-f33ea89a-7aec-4976-948c-db77b1499df0.mp4[options=loop]
13+
* pr:13120[] (first contribution) add assist to change between `XXX_or` and `XXX_or_else`:
14+
+
15+
video::https://user-images.githubusercontent.com/308347/188392529-be982a36-756a-400c-836d-b077de270c99.mp4[options=loop]
16+
* pr:13145[] add `Unmerge match arm` assist:
17+
+
18+
video::https://user-images.githubusercontent.com/308347/188388609-bb36bbff-bd38-480b-b6ae-7b41329a98af.mp4[options=loop]
19+
* pr:13167[] add support for unstable `#[feature(exhaustive_patterns)]` feature.
20+
21+
== Fixes
22+
23+
* pr:13134[] highlight name references by syntax until proc macros are loaded.
24+
* pr:13149[] unescape all occurrences of module name in module resolution.
25+
* pr:13151[] prefer expression type in `Replace turbofish with type`.
26+
* pr:12793[] sort and deduplicate auto traits in trait object types.
27+
* pr:13051[] don't move attributes when extracting a struct from an enum variant.
28+
* pr:13161[] lower float literals containing underscores.
29+
* pr:13160[] parse `TypePathFn` with preceding `::`.
30+
* pr:13187[] fix broken return completion.
31+
* pr:13165[] properly handle break resolution inside non-breakable expressions.
32+
* pr:13183[] fix nested break expressions expecting unknown types.
33+
* pr:13154[] drop the expander borrow in all control flow paths.
34+
35+
== Internal Improvements
36+
37+
* pr:13174[] lift out the module scope into a field in the `Resolver`.
38+
* pr:13056[] use format arg captures in `syntax::make`.
39+
* pr:13156[] remove `hir::Expr::MacroStmts`.
40+
* pr:13171[] ignore failures when publishing to OVSX.
41+
* pr:12963[] make generated code nice to read.
42+
* pr:13173[] don't store `SyntheticSyntax` in the reverse maps in `BodySourceMap`.
43+
* pr:13175[] clarify the state of (extern) preludes for block def maps.

0 commit comments

Comments
 (0)