fewer monomorphisations

This commit is contained in:
Aleksey Kladov 2019-09-25 17:19:16 +03:00
parent d9b4835625
commit b7422bd1ab
2 changed files with 6 additions and 6 deletions

View File

@ -44,9 +44,9 @@ impl<N: AstNode> AstEditor<N> {
fn insert_children(
&self,
position: InsertPosition<SyntaxElement>,
to_insert: impl Iterator<Item = SyntaxElement>,
mut to_insert: impl Iterator<Item = SyntaxElement>,
) -> N {
let new_syntax = insert_children(self.ast().syntax(), position, to_insert);
let new_syntax = insert_children(self.ast().syntax(), position, &mut to_insert);
N::cast(new_syntax).unwrap()
}
@ -54,9 +54,9 @@ impl<N: AstNode> AstEditor<N> {
fn replace_children(
&self,
to_delete: RangeInclusive<SyntaxElement>,
to_insert: impl Iterator<Item = SyntaxElement>,
mut to_insert: impl Iterator<Item = SyntaxElement>,
) -> N {
let new_syntax = replace_children(self.ast().syntax(), to_delete, to_insert);
let new_syntax = replace_children(self.ast().syntax(), to_delete, &mut to_insert);
N::cast(new_syntax).unwrap()
}

View File

@ -70,7 +70,7 @@ pub enum InsertPosition<T> {
pub fn insert_children(
parent: &SyntaxNode,
position: InsertPosition<SyntaxElement>,
to_insert: impl Iterator<Item = SyntaxElement>,
to_insert: &mut dyn Iterator<Item = SyntaxElement>,
) -> SyntaxNode {
let mut delta = TextUnit::default();
let to_insert = to_insert.map(|element| {
@ -108,7 +108,7 @@ pub fn insert_children(
pub fn replace_children(
parent: &SyntaxNode,
to_delete: RangeInclusive<SyntaxElement>,
to_insert: impl Iterator<Item = SyntaxElement>,
to_insert: &mut dyn Iterator<Item = SyntaxElement>,
) -> SyntaxNode {
let start = position_of_child(parent, to_delete.start().clone());
let end = position_of_child(parent, to_delete.end().clone());