Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax-bridge/src/lib.rs')
-rw-r--r--crates/syntax-bridge/src/lib.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/syntax-bridge/src/lib.rs b/crates/syntax-bridge/src/lib.rs
index d59229952f..4e525be3fe 100644
--- a/crates/syntax-bridge/src/lib.rs
+++ b/crates/syntax-bridge/src/lib.rs
@@ -127,11 +127,11 @@ where
// The following items are what `rustc` macro can be parsed into :
// link: https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/libsyntax/ext/expand.rs#L141
-// * Expr(P<ast::Expr>) -> token_tree_to_expr
-// * Pat(P<ast::Pat>) -> token_tree_to_pat
-// * Ty(P<ast::Ty>) -> token_tree_to_ty
+// * Expr(Box<ast::Expr>) -> token_tree_to_expr
+// * Pat(Box<ast::Pat>) -> token_tree_to_pat
+// * Ty(Box<ast::Ty>) -> token_tree_to_ty
// * Stmts(SmallVec<[ast::Stmt; 1]>) -> token_tree_to_stmts
-// * Items(SmallVec<[P<ast::Item>; 1]>) -> token_tree_to_items
+// * Items(SmallVec<[Box<ast::Item>; 1]>) -> token_tree_to_items
//
// * TraitItems(SmallVec<[ast::TraitItem; 1]>)
// * AssocItems(SmallVec<[ast::AssocItem; 1]>)
@@ -768,17 +768,17 @@ where
}
fn bump(&mut self) -> Option<(Self::Token, TextRange)> {
- if let Some((punct, offset)) = self.punct_offset.clone() {
- if usize::from(offset) + 1 < punct.text().len() {
- let offset = offset + TextSize::of('.');
- let range = punct.text_range();
- self.punct_offset = Some((punct.clone(), offset));
- let range = TextRange::at(range.start() + offset, TextSize::of('.'));
- return Some((
- SynToken::Punct { token: punct, offset: u32::from(offset) as usize },
- range,
- ));
- }
+ if let Some((punct, offset)) = self.punct_offset.clone()
+ && usize::from(offset) + 1 < punct.text().len()
+ {
+ let offset = offset + TextSize::of('.');
+ let range = punct.text_range();
+ self.punct_offset = Some((punct.clone(), offset));
+ let range = TextRange::at(range.start() + offset, TextSize::of('.'));
+ return Some((
+ SynToken::Punct { token: punct, offset: u32::from(offset) as usize },
+ range,
+ ));
}
if let Some(leaf) = self.current_leaves.pop() {