aboutsummaryrefslogtreecommitdiff
path: root/crates/mbe
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-01-18 17:40:06 +0000
committerJonas Schievink <[email protected]>2021-01-18 17:40:06 +0000
commit2d799cf5e0ffd414ce47d8b9478148f98b46028a (patch)
treecd9ef812cb400cdba2ea691e07e3cfb8a6d55944 /crates/mbe
parent9daba961f236750c3a5d831c9775606271b37eff (diff)
shrink_to_fit `TokenMap`'s backing storage
Diffstat (limited to 'crates/mbe')
-rw-r--r--crates/mbe/src/syntax_bridge.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index e648519f9..2a41d8167 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -51,6 +51,7 @@ pub fn syntax_node_to_token_tree(node: &SyntaxNode) -> Option<(tt::Subtree, Toke
51 let global_offset = node.text_range().start(); 51 let global_offset = node.text_range().start();
52 let mut c = Convertor::new(node, global_offset); 52 let mut c = Convertor::new(node, global_offset);
53 let subtree = c.go()?; 53 let subtree = c.go()?;
54 c.id_alloc.map.entries.shrink_to_fit();
54 Some((subtree, c.id_alloc.map)) 55 Some((subtree, c.id_alloc.map))
55} 56}
56 57
@@ -593,7 +594,8 @@ impl<'a> TtTreeSink<'a> {
593 } 594 }
594 } 595 }
595 596
596 fn finish(self) -> (Parse<SyntaxNode>, TokenMap) { 597 fn finish(mut self) -> (Parse<SyntaxNode>, TokenMap) {
598 self.token_map.entries.shrink_to_fit();
597 (self.inner.finish(), self.token_map) 599 (self.inner.finish(), self.token_map)
598 } 600 }
599} 601}