Skip to content

Commit 1a28473

Browse files
committed
Changelog #85
1 parent b8d2967 commit 1a28473

File tree

4 files changed

+95
-44
lines changed

4 files changed

+95
-44
lines changed

generated_assists.adoc

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,27 +1076,26 @@ fn foo() -> i32 { 42i32 }
10761076

10771077
[discrete]
10781078
=== `inline_call`
1079-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs#L13[inline_call.rs]
1079+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs#L15[inline_call.rs]
10801080

1081-
Inlines a function or method body.
1081+
Inlines a function or method body creating a `let` statement per parameter unless the parameter
1082+
can be inlined. The parameter will be inlined either if it the supplied argument is a simple local
1083+
or if the parameter is only accessed inside the function body once.
10821084

10831085
.Before
10841086
```rust
1085-
fn add(a: u32, b: u32) -> u32 { a + b }
1086-
fn main() {
1087-
let x = add┃(1, 2);
1087+
fn foo(name: Option<&str>) {
1088+
let name = name.unwrap┃();
10881089
}
10891090
```
10901091

10911092
.After
10921093
```rust
1093-
fn add(a: u32, b: u32) -> u32 { a + b }
1094-
fn main() {
1095-
let x = {
1096-
let a = 1;
1097-
let b = 2;
1098-
a + b
1099-
};
1094+
fn foo(name: Option<&str>) {
1095+
let name = match name {
1096+
Some(val) => val,
1097+
None => panic!("called `Option::unwrap()` on a `None` value"),
1098+
};
11001099
}
11011100
```
11021101

@@ -1156,7 +1155,6 @@ impl<'a> Cursor<'a> {
11561155
=== `invert_if`
11571156
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/invert_if.rs#L12[invert_if.rs]
11581157

1159-
Apply invert_if
11601158
This transforms if expressions of the form `if !x {A} else {B}` into `if x {B} else {A}`
11611159
This also works with `!=`. This assist can only be applied with the cursor
11621160
on `if`.
@@ -1677,7 +1675,7 @@ fn foo<B: Bar>(bar: B) {}
16771675
=== `replace_let_with_if_let`
16781676
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_let_with_if_let.rs#L15[replace_let_with_if_let.rs]
16791677

1680-
Replaces `let` with an `if-let`.
1678+
Replaces `let` with an `if let`.
16811679

16821680
.Before
16831681
```rust
@@ -1735,7 +1733,7 @@ fn handle(action: Action) {
17351733

17361734
[discrete]
17371735
=== `replace_qualified_name_with_use`
1738-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs#L10[replace_qualified_name_with_use.rs]
1736+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs#L13[replace_qualified_name_with_use.rs]
17391737

17401738
Adds a use statement for a given fully-qualified name.
17411739

@@ -1773,32 +1771,6 @@ fn main() {
17731771
```
17741772

17751773

1776-
[discrete]
1777-
=== `replace_unwrap_with_match`
1778-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/replace_unwrap_with_match.rs#L18[replace_unwrap_with_match.rs]
1779-
1780-
Replaces `unwrap` with a `match` expression. Works for Result and Option.
1781-
1782-
.Before
1783-
```rust
1784-
fn main() {
1785-
let x: Result<i32, i32> = Ok(92);
1786-
let y = x.┃unwrap();
1787-
}
1788-
```
1789-
1790-
.After
1791-
```rust
1792-
fn main() {
1793-
let x: Result<i32, i32> = Ok(92);
1794-
let y = match x {
1795-
Ok(it) => it,
1796-
┃_ => unreachable!(),
1797-
};
1798-
}
1799-
```
1800-
1801-
18021774
[discrete]
18031775
=== `split_import`
18041776
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/split_import.rs#L5[split_import.rs]

generated_config.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,21 @@ site.
281281
--
282282
Whether to show inlay type hints for variables.
283283
--
284+
[[rust-analyzer.joinLines.joinElseIf]]rust-analyzer.joinLines.joinElseIf (default: `true`)::
285+
+
286+
--
287+
Join lines inserts else between consecutive ifs.
288+
--
289+
[[rust-analyzer.joinLines.removeTrailingComma]]rust-analyzer.joinLines.removeTrailingComma (default: `true`)::
290+
+
291+
--
292+
Join lines removes trailing commas.
293+
--
294+
[[rust-analyzer.joinLines.unwrapTrivialBlock]]rust-analyzer.joinLines.unwrapTrivialBlock (default: `true`)::
295+
+
296+
--
297+
Join lines unwraps trivial blocks.
298+
--
284299
[[rust-analyzer.lens.debug]]rust-analyzer.lens.debug (default: `true`)::
285300
+
286301
--

generated_features.adoc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,14 @@ image::https://user-images.githubusercontent.com/48062697/113020660-b5f98b80-917
294294
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
295295

296296
== Join Lines
297-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/join_lines.rs#L15[join_lines.rs]
297+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/join_lines.rs#L21[join_lines.rs]
298298

299299
Join selected lines into one, smartly fixing up whitespace, trailing commas, and braces.
300300

301+
See
302+
https://user-images.githubusercontent.com/1711539/124515923-4504e800-dde9-11eb-8d58-d97945a1a785.gif[this gif]
303+
for the cases handled specially by joined lines.
304+
301305
|===
302306
| Editor | Action Name
303307

@@ -485,7 +489,7 @@ image::https://user-images.githubusercontent.com/48062697/113065580-04c21800-91b
485489
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
486490

487491
== Related Tests
488-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L146[runnables.rs]
492+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L189[runnables.rs]
489493

490494
Provides a sneak peek of all tests where the current item is used.
491495

@@ -519,7 +523,7 @@ image::https://user-images.githubusercontent.com/48062697/113065582-055aae80-91b
519523
// IMPORTANT: master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository
520524

521525
== Run
522-
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L91[runnables.rs]
526+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L108[runnables.rs]
523527

524528
Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
525529
location**. Super useful for repeatedly running just a single test. Do bind this
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
= Changelog #85
2+
:sectanchors:
3+
:page-layout: post
4+
5+
Commit: commit:fe00358888a24c64878abc15f09b0e60e16db9d6[] +
6+
Release: release:2021-07-12[]
7+
8+
== Sponsors
9+
10+
**Become a sponsor:** On https://opencollective.com/rust-analyzer/[OpenCollective] or
11+
https://github.com/sponsors/rust-analyzer[GitHub Sponsors].
12+
13+
== New Features
14+
15+
* pr:9478[], pr:9494[], pr:9523[] (first contribution) show imported trait on autocompletion of associated items:
16+
+
17+
image::https://user-images.githubusercontent.com/62165556/124471905-b5dcdd80-ddb2-11eb-8852-1d703ef6023f.png[]
18+
+
19+
image::https://user-images.githubusercontent.com/62165556/124471923-bffedc00-ddb2-11eb-9571-31b8b95499f1.png[]
20+
* pr:9568[] add `for` postfix completion:
21+
+
22+
image::https://user-images.githubusercontent.com/62165556/125194692-a0aaf780-e267-11eb-952a-81de7955d9a1.gif[]
23+
* pr:9498[] remove "Replace `unwrap` with `match`" assist in favor of "Inline call":
24+
+
25+
image::https://user-images.githubusercontent.com/3757771/124482574-b58c1480-dda9-11eb-940d-bc6a2fe4050b.gif[]
26+
* pr:9503[] make "Join lines" behavior configurable:
27+
+
28+
image::https://user-images.githubusercontent.com/1711539/124515923-4504e800-dde9-11eb-8d58-d97945a1a785.gif[]
29+
* pr:9449[] emit test names in "Run test" runnables if they come from a macro expansion:
30+
+
31+
image::https://user-images.githubusercontent.com/3757771/124174493-bb81ad00-daac-11eb-96c7-3de6545a62e1.png[]
32+
* pr:9555[] enable `auto_import` on ident patterns.
33+
* pr:9520[] complete `crate`, `super` and `self` in non-use tree paths.
34+
* pr:9548[] add `self` parameter completion.
35+
36+
== Fixes
37+
38+
* pr:9541[] (first contribution) make "Generate function" add `async` if the call is followed by `await`.
39+
* pr:9474[], pr:9500[] inline parameters in "Inline call" if possible.
40+
* pr:9497[] wrap inlined closures in parens when using "Inline call".
41+
* pr:9499[] fix cycle in visibility computation with modules from the same block.
42+
* pr:9496[] make file logging line-buffered.
43+
* pr:9526[], pr:9529[] coerce array elements to a common type.
44+
* pr:9536[] represent opaque types with `TyKind::OpaqueType`.
45+
* pr:9551[] keep qualifier in "Replace qualified name with use".
46+
* pr:9552[] make "Add explicit type" respect coercions.
47+
* pr:9557[] respect coercions in "Inline call".
48+
* pr:9569[] fix highlighting of field shorthands.
49+
* pr:9572[] work around older `synstructure` derives.
50+
51+
== Internal Improvements
52+
53+
* pr:9519[] (first contribution) name all spawned threads.
54+
* pr:9505[] ensure consistent passing of config params.
55+
* pr:9514[] invert boolean literals in assist negation logic.
56+
* pr:9512[] record coercion adjustments.
57+
* pr:9545[] record autoderef adjustments.
58+
* pr:9563[] move some presentation-specific concerns out of the IDE crate.
59+
* pr:9565[] document `NameClass` and `NameRefClass`.
60+
* pr:9567[] remove unneeded `NameClass::ExternCrate`.

0 commit comments

Comments
 (0)