From 7e74af32268f9b0783ca94107b0b10d52e4ebe5e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Aug 2018 14:06:30 +0300 Subject: Avoid materializing strings --- crates/libsyntax2/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/libsyntax2/src/lib.rs') diff --git a/crates/libsyntax2/src/lib.rs b/crates/libsyntax2/src/lib.rs index 93057dd6a..ccf13e4ab 100644 --- a/crates/libsyntax2/src/lib.rs +++ b/crates/libsyntax2/src/lib.rs @@ -81,7 +81,7 @@ impl File { pub fn incremental_reparse(&self, edit: &AtomEdit) -> Option { let (node, reparser) = find_reparsable_node(self.syntax(), edit.delete)?; let text = replace_range( - node.text(), + node.text().to_string(), edit.delete - node.range().start(), &edit.insert, ); @@ -97,7 +97,7 @@ impl File { Some(File::new(green_root, errors)) } fn full_reparse(&self, edit: &AtomEdit) -> File { - let text = replace_range(self.syntax().text(), edit.delete, &edit.insert); + let text = replace_range(self.syntax().text().to_string(), edit.delete, &edit.insert); File::parse(&text) } pub fn ast(&self) -> ast::Root { -- cgit v1.2.3