From b7422bd1abd03c02b4aa4a6a5d3dcc1136d37a42 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 25 Sep 2019 17:19:16 +0300 Subject: fewer monomorphisations --- crates/ra_assists/src/ast_editor.rs | 8 ++++---- crates/ra_syntax/src/algo.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crates') diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index a710edce8..cf32ea52d 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs @@ -44,9 +44,9 @@ impl AstEditor { fn insert_children( &self, position: InsertPosition, - to_insert: impl Iterator, + mut to_insert: impl Iterator, ) -> 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 AstEditor { fn replace_children( &self, to_delete: RangeInclusive, - to_insert: impl Iterator, + mut to_insert: impl Iterator, ) -> 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() } diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs index 45f624810..7ee5aa85b 100644 --- a/crates/ra_syntax/src/algo.rs +++ b/crates/ra_syntax/src/algo.rs @@ -70,7 +70,7 @@ pub enum InsertPosition { pub fn insert_children( parent: &SyntaxNode, position: InsertPosition, - to_insert: impl Iterator, + to_insert: &mut dyn Iterator, ) -> 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, - to_insert: impl Iterator, + to_insert: &mut dyn Iterator, ) -> SyntaxNode { let start = position_of_child(parent, to_delete.start().clone()); let end = position_of_child(parent, to_delete.end().clone()); -- cgit v1.2.3