Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-expand/src/builtin/derive_macro.rs7
-rw-r--r--crates/syntax/src/syntax_editor/edits.rs8
2 files changed, 9 insertions, 6 deletions
diff --git a/crates/hir-expand/src/builtin/derive_macro.rs b/crates/hir-expand/src/builtin/derive_macro.rs
index e8321cd8da..c4da558fda 100644
--- a/crates/hir-expand/src/builtin/derive_macro.rs
+++ b/crates/hir-expand/src/builtin/derive_macro.rs
@@ -22,7 +22,7 @@ use crate::{
use syntax::{
ast::{
self, AstNode, FieldList, HasAttrs, HasGenericArgs, HasGenericParams, HasModuleItem,
- HasName, HasTypeBounds, make,
+ HasName, HasTypeBounds,
},
syntax_editor::{GetOrCreateWhereClause, SyntaxEditor},
};
@@ -1435,6 +1435,7 @@ fn coerce_pointee_expand(
param_name: &str,
replacement: &str,
) -> bool {
+ let make = editor.make();
return match ty {
ast::Type::ArrayType(ty) => ty
.ty()
@@ -1462,8 +1463,8 @@ fn coerce_pointee_expand(
if path.as_single_name_ref().is_some_and(|name| name.text() == param_name) {
editor.replace(
path.syntax(),
- make::path_from_segments(
- [make::path_segment(make::name_ref(replacement))],
+ make.path_from_segments(
+ [make.path_segment(make.name_ref(replacement))],
false,
)
.syntax(),
diff --git a/crates/syntax/src/syntax_editor/edits.rs b/crates/syntax/src/syntax_editor/edits.rs
index 0338d976b0..f2b979eb9d 100644
--- a/crates/syntax/src/syntax_editor/edits.rs
+++ b/crates/syntax/src/syntax_editor/edits.rs
@@ -3,7 +3,7 @@
use crate::{
AstToken, Direction, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, T,
algo::neighbor,
- ast::{self, AstNode, HasGenericParams, HasName, edit::IndentLevel, make},
+ ast::{self, AstNode, HasGenericParams, HasName, edit::IndentLevel},
syntax_editor::{Position, SyntaxEditor},
};
@@ -207,6 +207,7 @@ impl ast::AssocItemList {
/// Attention! This function does align the first line of `item` with respect to `self`,
/// but it does _not_ change indentation of other lines (if any).
pub fn add_items(&self, editor: &SyntaxEditor, items: Vec<ast::AssocItem>) {
+ let make = editor.make();
let (indent, position, whitespace) = match self.assoc_items().last() {
Some(last_item) => (
IndentLevel::from_node(last_item.syntax()),
@@ -228,7 +229,7 @@ impl ast::AssocItemList {
.flat_map(|(i, item)| {
let whitespace = if i != 0 { "\n\n" } else { whitespace };
vec![
- make::tokens::whitespace(&format!("{whitespace}{indent}")).into(),
+ make.whitespace(&format!("{whitespace}{indent}")).into(),
item.syntax().clone().into(),
]
})
@@ -390,10 +391,11 @@ impl ast::VariantList {
impl ast::Fn {
pub fn replace_or_insert_body(&self, editor: &SyntaxEditor, body: ast::BlockExpr) {
+ let make = editor.make();
if let Some(old_body) = self.body() {
editor.replace(old_body.syntax(), body.syntax());
} else {
- let single_space = make::tokens::single_space();
+ let single_space = make.whitespace(" ");
let elements = vec![single_space.into(), body.syntax().clone().into()];
if let Some(semicolon) = self.semicolon_token() {