Commit graph

1314 commits

Author SHA1 Message Date
A4-Tacks
168ca55a99
Fix not applicable on trailing comma for remove_dbg
`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();
}
```
2025-09-21 11:05:10 +08:00
Shoyu Vanilla (Flint)
6d5bfaee6a
Merge pull request #20709 from A4-Tacks/destruct-panic-on-not-add-deref-and-paren
Fix panic `!self.data().mutable` for destructure_struct_binding
2025-09-20 12:41:21 +00:00
Shoyu Vanilla (Flint)
da47c3da45
Merge pull request #20686 from A4-Tacks/gen-default-not-apply-selected
Fix selected applicable generate_default_from_enum_variant
2025-09-20 12:40:50 +00:00
A4-Tacks
d6c66dff1d
Fix selected multi variants applicable generate_default_from_enum_variant 2025-09-20 20:29:02 +08:00
Shoyu Vanilla (Flint)
259a01d73d
Merge pull request #20688 from 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
2025-09-20 12:06:18 +00:00
Shoyu Vanilla (Flint)
84bb4051bf
Merge pull request #20700 from A4-Tacks/extract-var-let-expr
Fix extract_variable on LetExpr
2025-09-20 11:59:20 +00:00
A4-Tacks
f34e9ca8d3
Fix panic !self.data().mutable for destructure_struct_binding
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;
}
```
2025-09-20 17:52:01 +08:00
A4-Tacks
d4731ad9e2
Fix panics on Foo{mut x} for destructure_struct_binding
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) {}
```
2025-09-20 16:14:51 +08:00
Chayim Refael Friedman
b12a129347
Merge pull request #20701 from A4-Tacks/track-caller-assist-test
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Add `#[track_caller]` for check_assist_by_label
2025-09-19 15:07:17 +00:00
A4-Tacks
42bba767ef
Add #[track_caller] for check_assist_by_label 2025-09-19 13:39:45 +08:00
A4-Tacks
3610cb12f7
Fix extract_variable on LetExpr
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 {}
}
```
2025-09-19 13:35:34 +08:00
A4-Tacks
d3748517c9
Fix applicable after l_curly for replace_is_method_with_if_let_method 2025-09-18 20:00:31 +08:00
Chayim Refael Friedman
cd31e11f94
Merge pull request #20664 from ChayimFriedman2/coerce-ns
Some checks are pending
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
fix: Port a bunch of stuff from rustc and fix a bunch of type mismatches/diagnostics
2025-09-18 00:19:30 +00:00
Shoyu Vanilla (Flint)
2268a56350
Merge pull request #20682 from A4-Tacks/fix-change-vis-applicable-on-variant
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Fix applicable on variant field for change_visibility
2025-09-17 17:00:31 +00:00
A4-Tacks
5b5c50eec8
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
2025-09-17 22:57:25 +08:00
Lukas Wirth
aecb756876
Merge pull request #20517 from Veykril/veykril/push-wrurmtqppzus
fix: Only compute unstable paths on nightly toolchains for IDE features
2025-09-16 07:28:47 +00:00
Lukas Wirth
685f156fa6 fix: Only compute unstable paths on nightly toolchains for IDE features 2025-09-16 09:17:16 +02:00
Chayim Refael Friedman
7d1860807e Port a bunch of stuff from rustc and fix a bunch of type mismatches/diagnostics
This started from porting coercion, but ended with porting much more.
2025-09-15 18:56:17 +03:00
A4-Tacks
d0b95bd67f
Fix empty generic param list for generate_function
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!()
    }
}
```
2025-09-11 10:23:02 +08:00
A4-Tacks
7e2dc40642
Improve make::struct_ field_list whitespace
Example
---
**Before this PR**:

```rust
struct Variant{
    field: u32
}
```

**After this PR**:

```rust
struct Variant {
    field: u32
}
```
2025-09-07 22:19:52 +08:00
Shoyu Vanilla (Flint)
0358021a8f
Merge pull request #20534 from A4-Tacks/tog-macro-delim-semicolon
Fix ExprStmt delete semicolon for toggle_macro_delimiter
2025-08-26 05:55:08 +00:00
Shoyu Vanilla (Flint)
d86cf448c3
Merge pull request #20509 from A4-Tacks/fix-move-guard-to-arm-indent
Fix indent for move_guard_to_arm_body
2025-08-26 05:52:06 +00:00
Chayim Refael Friedman
870cb3329b
Merge pull request #20423 from ShoyuVanilla/import-2024
Some checks are pending
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Make import sorting order follow 2024 edition style
2025-08-25 19:19:31 +00:00
A4-Tacks
55b1ddbcc3
Fix ExprStmt delete semicolon for toggle_macro_delimiter 2025-08-25 16:45:12 +08:00
Chayim Refael Friedman
35369557a6
Merge pull request #20512 from A4-Tacks/arith-op-not-on-selected
replace_arith_op not applicable on selected
2025-08-24 00:17:09 +00:00
A4-Tacks
0fe2d7ffa1
replace_arith_op not applicable on selected 2025-08-24 07:57:50 +08:00
Chayim Refael Friedman
413ed5a361
Merge pull request #20511 from A4-Tacks/fix-conv-int-lit-on-selected
convert_integer_literal not on selected
2025-08-23 22:03:17 +00:00
A4-Tacks
5f8cfeb3f4
fix: convert_integer_literal not on selected
`convert_integer_literal` can only convert the first literal,
it is not reasonable to apply it when selected

Example
---

```rust
fn main() {
    $01+1$0;
}
```

**Assist old outputs**:

```
Convert 1 to 0b1
Convert 1 to 0o1
Convert 1 to 0x1
Replace arithmetic with call to checked_*
Replace arithmetic with call to saturating_*
Replace arithmetic with call to wrapping_*
Extract into variable
Extract into constant
Extract into static
Extract into function
```

**Assist this PR outputs**:

```
Replace arithmetic with call to checked_*
Replace arithmetic with call to saturating_*
Replace arithmetic with call to wrapping_*
Extract into variable
Extract into constant
Extract into static
Extract into function
```
2025-08-22 17:13:30 +08:00
A4-Tacks
f5f797e2d3
Fix indent for move_guard_to_arm_body
Input:

```rust
fn main() {
    match 92 {
        x $0if true
            && true
            && true =>
        {
            {
                false
            }
        },
        _ => true
    }
}
```

Old output:

```rust
fn main() {
    match 92 {
        x =>
        if true
                    && true
                    && true {
            {
                    {
                        false
                    }
                }
        },
        _ => true
    };
}
```

This PR fixed:

```rust
fn main() {
    match 92 {
        x => if true
            && true
            && true {
            {
                {
                    false
                }
            }
        },
        _ => true
    }
}
```
2025-08-22 11:43:03 +08:00
lcnr
1d4f709e60 user facing code should use not use PostAnalysis 2025-08-19 08:24:34 +02:00
Lukas Wirth
aed0fec1a9 Auto-attach database in Analysis calls 2025-08-18 09:52:23 +02:00
Shoyu Vanilla (Flint)
becf04b67a
Merge pull request #20442 from ChayimFriedman2/unqualify
fix: Only import the item in "Unqualify method call" if needed
2025-08-18 06:24:35 +00:00
Shoyu Vanilla (Flint)
4d7b9044c3
Merge pull request #20455 from A4-Tacks/fix-indent-conv-match-to-let-else
Fix indent for convert_match_to_let_else
2025-08-14 08:23:48 +00:00
Shoyu Vanilla (Flint)
83b852353a
Merge pull request #20456 from A4-Tacks/match-with-if-let-guard
Add guard to let-chain for replace_match_with_if_let
2025-08-14 08:22:05 +00:00
A4-Tacks
8399a88e99
Add guard to let-chain for replace_match_with_if_let
```rust
fn main() {
    match$0 Some(0) {
        Some(n) if n % 2 == 0 && n != 6 => (),
        _ => code(),
    }
}
```
->
```rust
fn main() {
    if let Some(n) = Some(0) && n % 2 == 0 && n != 6 {
        ()
    } else {
        code()
    }
}
2025-08-14 10:07:25 +08:00
A4-Tacks
e797f81f2a
Fix indent for convert_match_to_let_else
Example
---
```
//- minicore: option
fn f() {
    let x$0 = match Some(()) {
        Some(it) => it,
        None => {//comment
            println!("nope");
            return
        },
    };
}
```

**Old output**:

```rust
fn f() {
    let Some(x) = Some(()) else {//comment
            println!("nope");
            return
        };
}
```

**This PR output**:

```rust
fn f() {
    let Some(x) = Some(()) else {//comment
        println!("nope");
        return
    };
}
```
2025-08-14 08:34:31 +08:00
Deadbeef
82f174fbd9 Merge Trait and TraitAlias handling 2025-08-13 15:28:08 +08:00
Lukas Wirth
a9450ebba3
Merge pull request #20329 from jackh726/next-trait-solver-querify
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Switch from Chalk to the next trait solver
2025-08-13 06:10:45 +00:00
Chayim Refael Friedman
8c1c689977 Only import the item in "Unqualify method call" if needed 2025-08-13 05:23:58 +03:00
sgasho
8ab683759e fix: Implement default member to resolve IdentPat 2025-08-12 21:53:50 +09:00
Shoyu Vanilla
635b536f11 Make import sorting order follow 2024 edition style 2025-08-12 00:01:46 +09:00
A4-Tacks
62508aaca1
Fix extract_expressions_from_format_string on write!
**Input**:

```rust
fn main() {
    write!(f, "{2+3}$0")
}
```

**Old output**:

```rust
fn main() {
    write!("{}"$0, 2+3)
}
```

**This PR output**:

```rust
fn main() {
    write!(f, "{}"$0, 2+3)
}
```
2025-08-10 14:45:54 +08:00
jackh726
9418a3f2df Implement next trait solver 2025-08-09 16:08:58 +00:00
Hmikihiro
cfd41034e2 fix: generate function by indet token 2025-08-09 15:48:10 +09:00
Hmikihiro
fcd4010b03 In extract_module.rs, generate ast::Module instead of String 2025-08-07 02:29:59 +09:00
Chayim Refael Friedman
4b49c7bf3d
Merge pull request #20354 from A4-Tacks/clean-lit-stmt-remove-dbg
Add remove literal dbg stmt for remove_dbg
2025-08-06 13:45:51 +00:00
A4-Tacks
75fd004dec
Add remove simple dbg stmt for remove_dbg
Remove only contain literals dbg statement

```rust
fn foo() {
    let n = 2;
    $0dbg!(3);
    dbg!(2.6);
    dbg!(1, 2.5);
    dbg!('x');
    dbg!(&n);
    dbg!(n);
    // needless comment
    dbg!("foo");$0
}
```
->
```rust
fn foo() {
    // needless comment
}
```
Old:
```rust
fn foo() {
    3;
    2.6;
    (1, 2.5);
    'x';
    &n;
    n;
    // needless comment
    "foo";
}
```
2025-08-06 21:33:10 +08:00
Shoyu Vanilla (Flint)
2e283c1106
Merge pull request #20385 from Hmikihiro/migrate_expand_glob_import
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run
Migrate `expand_glob_import` assist to use `SyntaxEditor`
2025-08-05 09:47:09 +00:00
Shoyu Vanilla (Flint)
6600a1a18b
Merge pull request #20383 from Hmikihiro/remove_ted_from_replace_named_generic_with_impl
remove `ted` from replace_named_generic_with_impl.rs
2025-08-05 09:43:32 +00:00
Hmikihiro
0e456af6a1 Migrate expand_glob_import assist to use SyntaxEditor 2025-08-05 01:16:57 +09:00