diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/algo.rs | 12 | ||||
-rw-r--r-- | crates/ra_syntax/src/syntax_node.rs | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs index 1c075082a..e4061e994 100644 --- a/crates/ra_syntax/src/algo.rs +++ b/crates/ra_syntax/src/algo.rs | |||
@@ -140,13 +140,13 @@ pub fn insert_children( | |||
140 | }); | 140 | }); |
141 | 141 | ||
142 | let new_children = match &position { | 142 | let new_children = match &position { |
143 | InsertPosition::First => to_insert.chain(old_children).collect::<Box<[_]>>(), | 143 | InsertPosition::First => to_insert.chain(old_children).collect::<Vec<_>>(), |
144 | InsertPosition::Last => old_children.chain(to_insert).collect::<Box<[_]>>(), | 144 | InsertPosition::Last => old_children.chain(to_insert).collect::<Vec<_>>(), |
145 | InsertPosition::Before(anchor) | InsertPosition::After(anchor) => { | 145 | InsertPosition::Before(anchor) | InsertPosition::After(anchor) => { |
146 | let take_anchor = if let InsertPosition::After(_) = position { 1 } else { 0 }; | 146 | let take_anchor = if let InsertPosition::After(_) = position { 1 } else { 0 }; |
147 | let split_at = position_of_child(parent, anchor.clone()) + take_anchor; | 147 | let split_at = position_of_child(parent, anchor.clone()) + take_anchor; |
148 | let before = old_children.by_ref().take(split_at).collect::<Vec<_>>(); | 148 | let before = old_children.by_ref().take(split_at).collect::<Vec<_>>(); |
149 | before.into_iter().chain(to_insert).chain(old_children).collect::<Box<[_]>>() | 149 | before.into_iter().chain(to_insert).chain(old_children).collect::<Vec<_>>() |
150 | } | 150 | } |
151 | }; | 151 | }; |
152 | 152 | ||
@@ -174,7 +174,7 @@ pub fn replace_children( | |||
174 | .into_iter() | 174 | .into_iter() |
175 | .chain(to_insert.map(to_green_element)) | 175 | .chain(to_insert.map(to_green_element)) |
176 | .chain(old_children.skip(end + 1 - start)) | 176 | .chain(old_children.skip(end + 1 - start)) |
177 | .collect::<Box<[_]>>(); | 177 | .collect::<Vec<_>>(); |
178 | with_children(parent, new_children) | 178 | with_children(parent, new_children) |
179 | } | 179 | } |
180 | 180 | ||
@@ -187,7 +187,7 @@ pub fn replace_descendants( | |||
187 | map: &FxHashMap<SyntaxElement, SyntaxElement>, | 187 | map: &FxHashMap<SyntaxElement, SyntaxElement>, |
188 | ) -> SyntaxNode { | 188 | ) -> SyntaxNode { |
189 | // FIXME: this could be made much faster. | 189 | // FIXME: this could be made much faster. |
190 | let new_children = parent.children_with_tokens().map(|it| go(map, it)).collect::<Box<[_]>>(); | 190 | let new_children = parent.children_with_tokens().map(|it| go(map, it)).collect::<Vec<_>>(); |
191 | return with_children(parent, new_children); | 191 | return with_children(parent, new_children); |
192 | 192 | ||
193 | fn go( | 193 | fn go( |
@@ -211,7 +211,7 @@ pub fn replace_descendants( | |||
211 | 211 | ||
212 | fn with_children( | 212 | fn with_children( |
213 | parent: &SyntaxNode, | 213 | parent: &SyntaxNode, |
214 | new_children: Box<[NodeOrToken<rowan::GreenNode, rowan::GreenToken>]>, | 214 | new_children: Vec<NodeOrToken<rowan::GreenNode, rowan::GreenToken>>, |
215 | ) -> SyntaxNode { | 215 | ) -> SyntaxNode { |
216 | let len = new_children.iter().map(|it| it.text_len()).sum::<TextUnit>(); | 216 | let len = new_children.iter().map(|it| it.text_len()).sum::<TextUnit>(); |
217 | let new_node = | 217 | let new_node = |
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs index b2f5b8c64..041c6ea8d 100644 --- a/crates/ra_syntax/src/syntax_node.rs +++ b/crates/ra_syntax/src/syntax_node.rs | |||
@@ -40,7 +40,7 @@ pub use rowan::{Direction, NodeOrToken}; | |||
40 | 40 | ||
41 | pub struct SyntaxTreeBuilder { | 41 | pub struct SyntaxTreeBuilder { |
42 | errors: Vec<SyntaxError>, | 42 | errors: Vec<SyntaxError>, |
43 | inner: GreenNodeBuilder, | 43 | inner: GreenNodeBuilder<'static>, |
44 | } | 44 | } |
45 | 45 | ||
46 | impl Default for SyntaxTreeBuilder { | 46 | impl Default for SyntaxTreeBuilder { |