Skip to content

Migrate inline_call assist to SyntaxFactory#22352

Open
lukasmatta wants to merge 1 commit into
rust-lang:masterfrom
lukasmatta:migrate-inline-call-syntax-factory
Open

Migrate inline_call assist to SyntaxFactory#22352
lukasmatta wants to merge 1 commit into
rust-lang:masterfrom
lukasmatta:migrate-inline-call-syntax-factory

Conversation

@lukasmatta
Copy link
Copy Markdown

@lukasmatta lukasmatta commented May 12, 2026

Replaces the two remaining make:: calls in get_fn_params.

Part of #18285.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 12, 2026
@rustbot

This comment has been minimized.

@lukasmatta lukasmatta force-pushed the migrate-inline-call-syntax-factory branch from 42b6221 to 5295623 Compare May 12, 2026 22:59
Copy link
Copy Markdown
Member

@Shourya742 Shourya742 left a comment

Choose a reason for hiding this comment

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

You can define the editor before the get_fn_param, and use make via it.

View changes since this review

@lukasmatta
Copy link
Copy Markdown
Author

You can define the editor before the get_fn_param, and use make via it.

View changes since this review

Thanks for the feedback, I tried to address it, let me know if I'm on the right track.

@lukasmatta lukasmatta requested a review from Shourya742 May 13, 2026 21:13
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

Please also squash.

View changes since this review


let params = get_fn_params(ctx.sema.db, function, &param_list)?;
let def_file_editor = SyntaxEditor::new(
ast_func.syntax().ancestors().last().unwrap_or_else(|| ast_func.syntax().clone()),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
ast_func.syntax().ancestors().last().unwrap_or_else(|| ast_func.syntax().clone()),
ast_func.syntax().ancestors().last().unwrap(),

There is always a top ancestor (maybe we should have a method for that).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

addressed (did not attempt to introduce a new method in this PR, frankly I'd need a guidance where would be the best place for such a method to live)

.0;
let params = get_fn_params(ctx.sema.db, function, &param_list, &def_file_editor)?;

let mut file_editors: FxHashMap<FileId, SyntaxEditor> = FxHashMap::default();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
let mut file_editors: FxHashMap<FileId, SyntaxEditor> = FxHashMap::default();
let mut file_editors = FxHashMap::default();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

addressed

}
let params = get_fn_params(ctx.sema.db, function, &param_list)?;
let syntax = call_info.node.syntax().clone();
let editor = SyntaxEditor::new(syntax.ancestors().last().unwrap_or_else(|| syntax.clone())).0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
let editor = SyntaxEditor::new(syntax.ancestors().last().unwrap_or_else(|| syntax.clone())).0;
let editor = SyntaxEditor::new(syntax.ancestors().last().unwrap()).0;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

addressed

db: &'db dyn HirDatabase,
function: hir::Function,
param_list: &ast::ParamList,
file_editor: &SyntaxEditor,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given this only uses make, better to pass only it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

addressed

@lukasmatta lukasmatta force-pushed the migrate-inline-call-syntax-factory branch from 9dbf0e4 to 74af81d Compare May 15, 2026 17:19
@rustbot

This comment has been minimized.

@lukasmatta lukasmatta force-pushed the migrate-inline-call-syntax-factory branch from 74af81d to ad15548 Compare May 15, 2026 17:20
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 15, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@lukasmatta lukasmatta force-pushed the migrate-inline-call-syntax-factory branch from ad15548 to 3efd9b0 Compare May 15, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants