| Age | Commit message (Collapse) | Author | Lines |
|
Migrate `replace_arith_op` assist to use `SyntaxEditor`
|
|
Add applicable on bang `!` for apply_demorgan
|
|
|
|
Fix precedence parenthesis for replace_arith_op
|
|
Fix expand rest pattern in tuple and slice pattern
|
|
Assist: expand_tuple_rest_pattern
Fills fields by replacing rest pattern in tuple patterns.
Example
---
```
fn foo(bar: (char, i32, i32)) {
let (ch, ..$0) = bar;
}
```
->
```
fn foo(bar: (char, i32, i32)) {
let (ch, _1, _2) = bar;
}
```
---
Assist: expand_slice_rest_pattern
Fills fields by replacing rest pattern in slice patterns.
Example
---
```
fn foo(bar: [i32; 3]) {
let [first, ..$0] = bar;
}
```
->
```
fn foo(bar: [i32; 3]) {
let [first, _1, _2] = bar;
}
```
|
|
Add let-chain support for convert_to_guarded_return
|
|
Fix applicable on if-let-chain for invert_if
|
|
Example
---
```rust
fn main() {
let _f = || {
bar();
if$0 true {
foo();
// comment
bar();
}
}
}
```
->
```rust
fn main() {
let _f = || {
bar();
if false {
return;
}
foo();
// comment
bar();
}
}
```
|
|
Example
---
```rust
fn main() {
let _x = loop {
if$0 let Ok(x) = Err(92) {
foo(x);
}
};
}
```
**Before**:
Assist not applicable
**After**:
```rust
fn main() {
let _x = loop {
let Ok(x) = Err(92) else { continue };
foo(x);
};
}
```
|
|
- And add early expression `None` in function `Option` return
Example
---
```rust
fn main() {
if$0 let Ok(x) = Err(92)
&& x < 30
&& let Some(y) = Some(8)
{
foo(x, y);
}
}
```
->
```rust
fn main() {
let Ok(x) = Err(92) else { return };
if x >= 30 {
return;
}
let Some(y) = Some(8) else { return };
foo(x, y);
}
```
|
|
Example
---
```rust
fn f() { i$0f x && let Some(_) = Some(1) { 1 } else { 0 } }
```
**Before this PR**:
```rust
fn f() { if !(x && let Some(_) = Some(1)) { 0 } else { 1 } }
```
**After this PR**:
Assist not applicable
|
|
Fix "Replace match with if let" not to trigger when invalid transformations occur
|
|
Migrate `expand_record_rest_pattern` assist to use `SyntaxEditor`
|
|
Because `add_field` uses `ted`
|
|
|
|
Fix closure in match not applicable for add_braces
|
|
Fix apply in inner if for pull_assignment_up
|
|
Fixes:
- applicable on underscore prefix parameter
- using binding mode as an expression
Examples
---
```rust
fn foo($0_x: i32, y: i32) {}
```
**Before this PR**:
```rust
fn foo(_x: i32, y: i32) {
let _ = _x;
}
```
**After this PR**:
Assist not applicable
---
```rust
fn foo(ref $0y: i32) {}
```
**Before this PR**:
```rust
fn foo(ref y: i32) {
let _ = ref y;
}
```
**After this PR**:
```rust
fn foo(ref y: i32) {
let _ = y;
}
```
|
|
Example
---
```rust
fn foo() {
let mut a = 1;
if true {
a = 2;
} else if true {
$0a = 3;
} else {
a = 4;
}
}
```
**Before this PR**:
```rust
fn foo() {
let mut a = 1;
if true {
a = 2;
} else a = if true {
3
} else {
4
};
}
```
**After this PR**:
```rust
fn foo() {
let mut a = 1;
a = if true {
2
} else if true {
3
} else {
4
};
}
```
|
|
`remove_dbg` not applicable for whitespaces after trailing comma
Example
---
```rust
fn foo() {
dbg!(
bar(),
);
}
```
**Before this PR**:
Assist not applicable
**After this PR**:
```rust
fn foo() {
bar();
}
```
|
|
A4-Tacks/destruct-panic-on-not-add-deref-and-paren
Fix panic `!self.data().mutable` for destructure_struct_binding
|
|
Fix selected applicable generate_default_from_enum_variant
|
|
|
|
A4-Tacks/fix-applicable-after-l-curly-replace-is-method-with-if-let
Fix applicable after l_curly for replace_is_method_with_if_let_method
|
|
Fix extract_variable on LetExpr
|
|
When the reference type does not require adding a dereference or parentheses, it will panic
Example
---
```rust
struct Foo { bar: i32, baz: i32 }
fn main() {
let $0foo = &Foo { bar: 1, baz: 2 };
let _ = &foo.bar;
}
```
**Before this PR**:
Panic:
```
assertion failed: !self.data().mutable
```
**After this PR**:
```rust
struct Foo { bar: i32, baz: i32 }
fn main() {
let Foo { bar, baz } = &Foo { bar: 1, baz: 2 };
let _ = bar;
}
```
|
|
Example
---
```rust
struct Foo { x: () }
struct Bar { foo: Foo }
fn f(Bar { mut $0foo }: Bar) {}
```
**Before this PR**:
Panic `Option::unwrap`
**After this PR**:
```rust
struct Foo { x: () }
struct Bar { foo: Foo }
fn f(Bar { foo: Foo { mut x } }: Bar) {}
```
|
|
Add `#[track_caller]` for check_assist_by_label
|
|
|
|
Example
---
```rust
fn main() {
if $0let$0 Some(x) = Some(2+2) {}
}
```
**Before this PR**:
```rust
fn main() {
let $0var_name = let Some(x) = Some(2+2);
if var_name {}
}
```
**After this PR**:
```rust
fn main() {
let $0var_name = Some(2+2);
if let Some(x) = var_name {}
}
```
|
|
|
|
fix: Port a bunch of stuff from rustc and fix a bunch of type mismatches/diagnostics
|
|
Fix applicable on variant field for change_visibility
|
|
Enum variant fields do not allow visibility
Example
---
```rust
enum Foo {
Variant($0String),
}
```
**Before this PR**:
```rust
enum Foo {
Variant(pub(crate) String),
}
```
**After this PR**:
Assist not applicable
|
|
fix: Only compute unstable paths on nightly toolchains for IDE features
|
|
|
|
This started from porting coercion, but ended with porting much more.
|
|
Example
---
```rust
struct Foo<S>(S);
impl<S> Foo<S> {
fn foo(&self) {
self.bar()$0;
}
}
```
**Before this PR**:
```rust
struct Foo<S>(S);
impl<S> Foo<S> {
fn foo(&self) {
self.bar();
}
fn bar<>(&self) ${0:-> _} {
todo!()
}
}
```
**After this PR**:
```rust
struct Foo<S>(S);
impl<S> Foo<S> {
fn foo(&self) {
self.bar();
}
fn bar(&self) ${0:-> _} {
todo!()
}
}
```
|
|
Example
---
**Before this PR**:
```rust
struct Variant{
field: u32
}
```
**After this PR**:
```rust
struct Variant {
field: u32
}
```
|
|
Example
---
```rust
fn main() {
let x = 1*x $0+ 2;
}
```
**Before this PR**:
```rust
fn main() {
let x = 1*x.wrapping_add(2);
}
```
**After this PR**:
```rust
fn main() {
let x = (1*x).wrapping_add(2);
}
```
|
|
Example
---
```rust
fn f() { $0!(1 || 3 && 4 || 5) }
```
->
```rust
fn f() { !1 && !(3 && 4) && !5 }
```
|
|
Example
---
**Not applicable**:
```rust
fn foo() {
match () {
() => {
t(|n|$0 n + 100);
}
}
}
```
|
|
|
|
Fix ExprStmt delete semicolon for toggle_macro_delimiter
|
|
Fix indent for move_guard_to_arm_body
|
|
Make import sorting order follow 2024 edition style
|
|
|
|
replace_arith_op not applicable on selected
|
|
|