Replace direct usage of make with syntax factory and migrate assist to syntaxEditor#21847
Merged
A4-Tacks merged 6 commits intorust-lang:masterfrom Mar 20, 2026
Merged
Conversation
replace use of make directly via syntaxFactory in replace_let_with_if_let assist
A4-Tacks
reviewed
Mar 20, 2026
| let fake_expr_let = | ||
| ast::make::expr_let(ast::make::tuple_pat(None).into(), ast::make::ext::expr_unit()); | ||
| fn let_expr_needs_paren(expr: &ast::Expr, make: &SyntaxFactory) -> bool { | ||
| let fake_expr_let = make.expr_let(make.tuple_pat(None).into(), make.expr_unit()); |
Member
There was a problem hiding this comment.
This does not require mapping, or even a mutable tree
Member
Author
There was a problem hiding this comment.
That thought occurred to me as well while migrating, but I wasn’t sure whether it makes sense to introduce a new constructor method for this. Curious to hear your suggestion, ideally without reusing make directly. For now, I used without_mapping variant here, at least to avoid the mapping.
Member
There was a problem hiding this comment.
but I wasn’t sure whether it makes sense to introduce a new constructor method for this.
It seems that the goal is to completely remove the mutable tree?
A4-Tacks
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR migrates direct use of make in assist with methods from syntax Factory, it also make migrates a couple of assists to
SyntaxEditorandSyntax Factory, which arequalify_method_call,qualify_pathanddesugar_try_exprpart of #15710 and #18285