Skip to content

Migrate unqualify_method_call assist to SyntaxEditor#21774

Merged
A4-Tacks merged 1 commit intorust-lang:masterfrom
akashchakrabortymsc-cmd:migrate-unqualify-method-call
Mar 7, 2026
Merged

Migrate unqualify_method_call assist to SyntaxEditor#21774
A4-Tacks merged 1 commit intorust-lang:masterfrom
akashchakrabortymsc-cmd:migrate-unqualify-method-call

Conversation

@akashchakrabortymsc-cmd
Copy link
Contributor

part of #18285

Migrates the unqualify_method_call assist handler from the old ted::/SourceChangeBuilder text-edit API to the new SyntaxEditor/SyntaxFactory API.

Changes

  • Replace text-range based edits (edit.delete, edit.insert, edit.replace) with node-based edits using SyntaxEditor
  • Replace builder.make_mut() with builder.make_editor()
  • Replace insert_use with insert_use_with_editor
  • Handle receiver parenthesization using make.expr_paren() and ExprPrecedence::Postfix instead of manual text-range insertion

Testing

All 9 existing tests pass.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 7, 2026
Copy link
Member

@A4-Tacks A4-Tacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let make = SyntaxFactory::with_mappings();
let mut editor = builder.make_editor(call.syntax());

let new_arg_list = make.arg_list(args.args().skip(1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will lose the trivia between args, such as a multi line ArgList, but it is also imperfect before migration, it is okay

@A4-Tacks A4-Tacks added this pull request to the merge queue Mar 7, 2026
Merged via the queue into rust-lang:master with commit a1b86d6 Mar 7, 2026
17 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants