about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/ide-assists
AgeCommit message (Collapse)AuthorLines
2025-09-26Merge pull request #20748 from A4-Tacks/migrate-arith-op-precShoyu Vanilla (Flint)-12/+15
Migrate `replace_arith_op` assist to use `SyntaxEditor`
2025-09-26Merge pull request #20599 from A4-Tacks/bang-de-morganShoyu Vanilla (Flint)-7/+28
Add applicable on bang `!` for apply_demorgan
2025-09-26Migrate `replace_arith_op` assist to use `SyntaxEditor`A4-Tacks-12/+15
2025-09-26Merge pull request #20611 from A4-Tacks/replace-arith-op-precShoyu Vanilla (Flint)-1/+22
Fix precedence parenthesis for replace_arith_op
2025-09-26Merge pull request #20731 from A4-Tacks/expand-rest-pat-in-tuple-slice-patShoyu Vanilla (Flint)-19/+289
Fix expand rest pattern in tuple and slice pattern
2025-09-26Fix expand rest pattern in tuple and slice patternA4-Tacks-19/+289
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; } ```
2025-09-26Merge pull request #20598 from A4-Tacks/let-chain-sup-conv-to-guarded-retShoyu Vanilla (Flint)-45/+252
Add let-chain support for convert_to_guarded_return
2025-09-26Merge pull request #20736 from A4-Tacks/fix-invert-if-let-chainShoyu Vanilla (Flint)-0/+12
Fix applicable on if-let-chain for invert_if
2025-09-25Add applicable in closure for convert_to_guarded_returnA4-Tacks-5/+49
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(); } } ```
2025-09-25Fix not applicable for if-expr in let-stmtA4-Tacks-6/+28
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); }; } ```
2025-09-25Add let-chain support for convert_to_guarded_returnA4-Tacks-38/+179
- 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); } ```
2025-09-24Fix applicable on if-let-chain for invert_ifA4-Tacks-0/+12
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
2025-09-23Merge pull request #20543 from sgasho/fix/19443_replace_match_with_if_letShoyu Vanilla (Flint)-1/+23
Fix "Replace match with if let" not to trigger when invalid transformations occur
2025-09-23Merge pull request #20730 from A4-Tacks/migrate-expand-rest-patShoyu Vanilla (Flint)-12/+11
Migrate `expand_record_rest_pattern` assist to use `SyntaxEditor`
2025-09-23Migrate `expand_record_rest_pattern` assist to use `SyntaxEditor`A4-Tacks-12/+11
Because `add_field` uses `ted`
2025-09-23Make Field::ty return TypeNsjackh726-3/+6
2025-09-22Merge pull request #20592 from A4-Tacks/add-braces-closure-in-matchShoyu Vanilla (Flint)-2/+31
Fix closure in match not applicable for add_braces
2025-09-22Merge pull request #20722 from A4-Tacks/pull-assign-up-inner-ifShoyu Vanilla (Flint)-0/+35
Fix apply in inner if for pull_assignment_up
2025-09-22Fix applicable on underscore for bind_unused_paramA4-Tacks-3/+30
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; } ```
2025-09-22Fix apply in internal if for pull_assignment_upA4-Tacks-0/+35
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 }; } ```
2025-09-21Fix not applicable on trailing comma for remove_dbgA4-Tacks-1/+16
`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-20Merge pull request #20709 from ↵Shoyu Vanilla (Flint)-2/+48
A4-Tacks/destruct-panic-on-not-add-deref-and-paren Fix panic `!self.data().mutable` for destructure_struct_binding
2025-09-20Merge pull request #20686 from A4-Tacks/gen-default-not-apply-selectedShoyu Vanilla (Flint)-0/+46
Fix selected applicable generate_default_from_enum_variant
2025-09-20Fix selected multi variants applicable generate_default_from_enum_variantA4-Tacks-0/+46
2025-09-20Merge pull request #20688 from ↵Shoyu Vanilla (Flint)-0/+18
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-20Merge pull request #20700 from A4-Tacks/extract-var-let-exprShoyu Vanilla (Flint)-1/+28
Fix extract_variable on LetExpr
2025-09-20Fix panic `!self.data().mutable` for destructure_struct_bindingA4-Tacks-2/+48
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-20Fix panics on `Foo{mut x}` for destructure_struct_bindingA4-Tacks-9/+96
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-19Merge pull request #20701 from A4-Tacks/track-caller-assist-testChayim Refael Friedman-0/+1
Add `#[track_caller]` for check_assist_by_label
2025-09-19Add `#[track_caller]` for check_assist_by_labelA4-Tacks-0/+1
2025-09-19Fix extract_variable on LetExprA4-Tacks-1/+28
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-18Fix applicable after l_curly for replace_is_method_with_if_let_methodA4-Tacks-0/+18
2025-09-18Merge pull request #20664 from ChayimFriedman2/coerce-nsChayim Refael Friedman-4/+5
fix: Port a bunch of stuff from rustc and fix a bunch of type mismatches/diagnostics
2025-09-17Merge pull request #20682 from A4-Tacks/fix-change-vis-applicable-on-variantShoyu Vanilla (Flint)-0/+14
Fix applicable on variant field for change_visibility
2025-09-17Fix applicable on variant field for change_visibilityA4-Tacks-0/+14
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-16Merge pull request #20517 from Veykril/veykril/push-wrurmtqppzusLukas Wirth-55/+63
fix: Only compute unstable paths on nightly toolchains for IDE features
2025-09-16fix: Only compute unstable paths on nightly toolchains for IDE featuresLukas Wirth-55/+63
2025-09-15Port a bunch of stuff from rustc and fix a bunch of type mismatches/diagnosticsChayim Refael Friedman-4/+5
This started from porting coercion, but ended with porting much more.
2025-09-11Fix empty generic param list for generate_functionA4-Tacks-1/+30
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-07Improve make::struct_ field_list whitespaceA4-Tacks-22/+22
Example --- **Before this PR**: ```rust struct Variant{ field: u32 } ``` **After this PR**: ```rust struct Variant { field: u32 } ```
2025-09-05Fix precedence parenthesis for replace_arith_opA4-Tacks-1/+22
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); } ```
2025-09-03Add applicable on bang `!` for apply_demorganA4-Tacks-7/+28
Example --- ```rust fn f() { $0!(1 || 3 && 4 || 5) } ``` -> ```rust fn f() { !1 && !(3 && 4) && !5 } ```
2025-09-03Fix closure in match not applicable for add_bracesA4-Tacks-2/+31
Example --- **Not applicable**: ```rust fn foo() { match () { () => { t(|n|$0 n + 100); } } } ```
2025-08-27fix: Prevent invalid transformation in 'Replace match with if let' assistsgasho-1/+23
2025-08-26Merge pull request #20534 from A4-Tacks/tog-macro-delim-semicolonShoyu Vanilla (Flint)-3/+33
Fix ExprStmt delete semicolon for toggle_macro_delimiter
2025-08-26Merge pull request #20509 from A4-Tacks/fix-move-guard-to-arm-indentShoyu Vanilla (Flint)-13/+57
Fix indent for move_guard_to_arm_body
2025-08-25Merge pull request #20423 from ShoyuVanilla/import-2024Chayim Refael Friedman-12/+12
Make import sorting order follow 2024 edition style
2025-08-25Fix ExprStmt delete semicolon for toggle_macro_delimiterA4-Tacks-3/+33
2025-08-24Merge pull request #20512 from A4-Tacks/arith-op-not-on-selectedChayim Refael Friedman-1/+16
replace_arith_op not applicable on selected
2025-08-24replace_arith_op not applicable on selectedA4-Tacks-1/+16