diff options
author | Aleksey Kladov <[email protected]> | 2019-09-25 15:19:16 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-25 15:19:16 +0100 |
commit | b7422bd1abd03c02b4aa4a6a5d3dcc1136d37a42 (patch) | |
tree | c1f25fa59902c3ceab9e6c54a9faba655fa24baa | |
parent | d9b4835625ac96c7628e2ef66ef6e26cc48d231f (diff) |
fewer monomorphisations
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 8 | ||||
-rw-r--r-- | crates/ra_syntax/src/algo.rs | 4 |
2 files changed, 6 insertions, 6 deletions
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<N: AstNode> AstEditor<N> { | |||
44 | fn insert_children( | 44 | fn insert_children( |
45 | &self, | 45 | &self, |
46 | position: InsertPosition<SyntaxElement>, | 46 | position: InsertPosition<SyntaxElement>, |
47 | to_insert: impl Iterator<Item = SyntaxElement>, | 47 | mut to_insert: impl Iterator<Item = SyntaxElement>, |
48 | ) -> N { | 48 | ) -> N { |
49 | let new_syntax = insert_children(self.ast().syntax(), position, to_insert); | 49 | let new_syntax = insert_children(self.ast().syntax(), position, &mut to_insert); |
50 | N::cast(new_syntax).unwrap() | 50 | N::cast(new_syntax).unwrap() |
51 | } | 51 | } |
52 | 52 | ||
@@ -54,9 +54,9 @@ impl<N: AstNode> AstEditor<N> { | |||
54 | fn replace_children( | 54 | fn replace_children( |
55 | &self, | 55 | &self, |
56 | to_delete: RangeInclusive<SyntaxElement>, | 56 | to_delete: RangeInclusive<SyntaxElement>, |
57 | to_insert: impl Iterator<Item = SyntaxElement>, | 57 | mut to_insert: impl Iterator<Item = SyntaxElement>, |
58 | ) -> N { | 58 | ) -> N { |
59 | let new_syntax = replace_children(self.ast().syntax(), to_delete, to_insert); | 59 | let new_syntax = replace_children(self.ast().syntax(), to_delete, &mut to_insert); |
60 | N::cast(new_syntax).unwrap() | 60 | N::cast(new_syntax).unwrap() |
61 | } | 61 | } |
62 | 62 | ||
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<T> { | |||
70 | pub fn insert_children( | 70 | pub fn insert_children( |
71 | parent: &SyntaxNode, | 71 | parent: &SyntaxNode, |
72 | position: InsertPosition<SyntaxElement>, | 72 | position: InsertPosition<SyntaxElement>, |
73 | to_insert: impl Iterator<Item = SyntaxElement>, | 73 | to_insert: &mut dyn Iterator<Item = SyntaxElement>, |
74 | ) -> SyntaxNode { | 74 | ) -> SyntaxNode { |
75 | let mut delta = TextUnit::default(); | 75 | let mut delta = TextUnit::default(); |
76 | let to_insert = to_insert.map(|element| { | 76 | let to_insert = to_insert.map(|element| { |
@@ -108,7 +108,7 @@ pub fn insert_children( | |||
108 | pub fn replace_children( | 108 | pub fn replace_children( |
109 | parent: &SyntaxNode, | 109 | parent: &SyntaxNode, |
110 | to_delete: RangeInclusive<SyntaxElement>, | 110 | to_delete: RangeInclusive<SyntaxElement>, |
111 | to_insert: impl Iterator<Item = SyntaxElement>, | 111 | to_insert: &mut dyn Iterator<Item = SyntaxElement>, |
112 | ) -> SyntaxNode { | 112 | ) -> SyntaxNode { |
113 | let start = position_of_child(parent, to_delete.start().clone()); | 113 | let start = position_of_child(parent, to_delete.start().clone()); |
114 | let end = position_of_child(parent, to_delete.end().clone()); | 114 | let end = position_of_child(parent, to_delete.end().clone()); |