Merge pull request #19568 from snprajwal/destructure-struct-editor

refactor: editor for `destructure_struct_binding`
This commit is contained in:
Lukas Wirth 2025-04-14 15:35:00 +00:00 committed by GitHub
commit 7fc29a99ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 76 additions and 99 deletions

View file

@ -643,8 +643,8 @@ pub fn expr_method_call(
) -> ast::MethodCallExpr {
expr_from_text(&format!("{receiver}.{method}{arg_list}"))
}
pub fn expr_macro_call(f: ast::Expr, arg_list: ast::ArgList) -> ast::Expr {
expr_from_text(&format!("{f}!{arg_list}"))
pub fn expr_macro(path: ast::Path, arg_list: ast::ArgList) -> ast::MacroExpr {
expr_from_text(&format!("{path}!{arg_list}"))
}
pub fn expr_ref(expr: ast::Expr, exclusive: bool) -> ast::Expr {
expr_from_text(&if exclusive { format!("&mut {expr}") } else { format!("&{expr}") })