aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-04-17 09:30:39 +0100
committerBenjamin Coenen <[email protected]>2020-04-17 09:30:39 +0100
commit0a1585075c65dd6049fc11c641309c89210e222d (patch)
treeceda5ef63d2179f25a7d5abaa16fa1dc30c9867b /crates/ra_mbe/src
parent071ef268b5c8fb9afec1db912ebcc5d6577f5e73 (diff)
parent8d296be1090b21b60e509c831864ae85feec2490 (diff)
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
Diffstat (limited to 'crates/ra_mbe/src')
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index 9fb5cb058..31e9b22e7 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -607,12 +607,13 @@ impl<'a> TreeSink for TtTreeSink<'a> {
607 let text: SmolStr = match self.cursor.token_tree() { 607 let text: SmolStr = match self.cursor.token_tree() {
608 Some(tt::TokenTree::Leaf(leaf)) => { 608 Some(tt::TokenTree::Leaf(leaf)) => {
609 // Mark the range if needed 609 // Mark the range if needed
610 let id = match leaf { 610 let (text, id) = match leaf {
611 tt::Leaf::Ident(ident) => ident.id, 611 tt::Leaf::Ident(ident) => (ident.text.clone(), ident.id),
612 tt::Leaf::Punct(punct) => punct.id, 612 tt::Leaf::Punct(punct) => {
613 tt::Leaf::Literal(lit) => lit.id, 613 (SmolStr::new_inline_from_ascii(1, &[punct.char as u8]), punct.id)
614 }
615 tt::Leaf::Literal(lit) => (lit.text.clone(), lit.id),
614 }; 616 };
615 let text = SmolStr::new(format!("{}", leaf));
616 let range = TextRange::offset_len(self.text_pos, TextUnit::of_str(&text)); 617 let range = TextRange::offset_len(self.text_pos, TextUnit::of_str(&text));
617 self.token_map.insert(id, range); 618 self.token_map.insert(id, range);
618 self.cursor = self.cursor.bump(); 619 self.cursor = self.cursor.bump();