aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/syntax_bridge.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_mbe/src/syntax_bridge.rs')
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index 2aaf0215f..d8ee74faa 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -388,11 +388,12 @@ impl<'a> TreeSink for TtTreeSink<'a> {
388 return; 388 return;
389 } 389 }
390 390
391 let mut last = self.cursor;
391 for _ in 0..n_tokens { 392 for _ in 0..n_tokens {
392 if self.cursor.eof() { 393 if self.cursor.eof() {
393 break; 394 break;
394 } 395 }
395 396 last = self.cursor;
396 let text: SmolStr = match self.cursor.token_tree() { 397 let text: SmolStr = match self.cursor.token_tree() {
397 Some(tt::TokenTree::Leaf(leaf)) => { 398 Some(tt::TokenTree::Leaf(leaf)) => {
398 // Mark the range if needed 399 // Mark the range if needed
@@ -441,11 +442,11 @@ impl<'a> TreeSink for TtTreeSink<'a> {
441 self.inner.token(kind, text); 442 self.inner.token(kind, text);
442 443
443 // Add whitespace between adjoint puncts 444 // Add whitespace between adjoint puncts
444 let next = self.cursor.bump(); 445 let next = last.bump();
445 if let ( 446 if let (
446 Some(tt::TokenTree::Leaf(tt::Leaf::Punct(curr))), 447 Some(tt::TokenTree::Leaf(tt::Leaf::Punct(curr))),
447 Some(tt::TokenTree::Leaf(tt::Leaf::Punct(_))), 448 Some(tt::TokenTree::Leaf(tt::Leaf::Punct(_))),
448 ) = (self.cursor.token_tree(), next.token_tree()) 449 ) = (last.token_tree(), next.token_tree())
449 { 450 {
450 if curr.spacing == tt::Spacing::Alone { 451 if curr.spacing == tt::Spacing::Alone {
451 self.inner.token(WHITESPACE, " ".into()); 452 self.inner.token(WHITESPACE, " ".into());