aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_mbe/src')
-rw-r--r--crates/ra_mbe/src/subtree_source.rs4
-rw-r--r--crates/ra_mbe/src/tt_cursor.rs16
2 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_mbe/src/subtree_source.rs b/crates/ra_mbe/src/subtree_source.rs
index e1c6e7d91..6603ff34d 100644
--- a/crates/ra_mbe/src/subtree_source.rs
+++ b/crates/ra_mbe/src/subtree_source.rs
@@ -145,7 +145,7 @@ fn convert_ident(ident: &tt::Ident) -> TtToken {
145 TtToken { kind, is_joint_to_next: false, text: ident.text.clone() } 145 TtToken { kind, is_joint_to_next: false, text: ident.text.clone() }
146} 146}
147 147
148fn convert_punct(p: &tt::Punct) -> TtToken { 148fn convert_punct(p: tt::Punct) -> TtToken {
149 let kind = match p.char { 149 let kind = match p.char {
150 // lexer may produce compound tokens for these ones 150 // lexer may produce compound tokens for these ones
151 '.' => T![.], 151 '.' => T![.],
@@ -167,6 +167,6 @@ fn convert_leaf(leaf: &tt::Leaf) -> TtToken {
167 match leaf { 167 match leaf {
168 tt::Leaf::Literal(l) => convert_literal(l), 168 tt::Leaf::Literal(l) => convert_literal(l),
169 tt::Leaf::Ident(ident) => convert_ident(ident), 169 tt::Leaf::Ident(ident) => convert_ident(ident),
170 tt::Leaf::Punct(punct) => convert_punct(punct), 170 tt::Leaf::Punct(punct) => convert_punct(*punct),
171 } 171 }
172} 172}
diff --git a/crates/ra_mbe/src/tt_cursor.rs b/crates/ra_mbe/src/tt_cursor.rs
index 8e360ce0f..468276397 100644
--- a/crates/ra_mbe/src/tt_cursor.rs
+++ b/crates/ra_mbe/src/tt_cursor.rs
@@ -170,20 +170,20 @@ impl<'a> TtCursor<'a> {
170 } 170 }
171 } 171 }
172 172
173 fn eat_punct3(&mut self, p: &tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> { 173 fn eat_punct3(&mut self, p: tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> {
174 let sec = *self.eat_punct()?; 174 let sec = *self.eat_punct()?;
175 let third = *self.eat_punct()?; 175 let third = *self.eat_punct()?;
176 Some(smallvec![*p, sec, third]) 176 Some(smallvec![p, sec, third])
177 } 177 }
178 178
179 fn eat_punct2(&mut self, p: &tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> { 179 fn eat_punct2(&mut self, p: tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> {
180 let sec = *self.eat_punct()?; 180 let sec = *self.eat_punct()?;
181 Some(smallvec![*p, sec]) 181 Some(smallvec![p, sec])
182 } 182 }
183 183
184 fn eat_multi_char_punct<'b, I>( 184 fn eat_multi_char_punct<'b, I>(
185 &mut self, 185 &mut self,
186 p: &tt::Punct, 186 p: tt::Punct,
187 iter: &mut TokenPeek<'b, I>, 187 iter: &mut TokenPeek<'b, I>,
188 ) -> Option<SmallVec<[tt::Punct; 3]>> 188 ) -> Option<SmallVec<[tt::Punct; 3]>>
189 where 189 where
@@ -250,7 +250,7 @@ impl<'a> TtCursor<'a> {
250 // But at this phase, some punct still is jointed. 250 // But at this phase, some punct still is jointed.
251 // So we by pass that check here. 251 // So we by pass that check here.
252 let mut peekable = TokenPeek::new(self.subtree.token_trees[self.pos..].iter()); 252 let mut peekable = TokenPeek::new(self.subtree.token_trees[self.pos..].iter());
253 let puncts = self.eat_multi_char_punct(punct, &mut peekable); 253 let puncts = self.eat_multi_char_punct(*punct, &mut peekable);
254 let puncts = puncts.unwrap_or_else(|| smallvec![*punct]); 254 let puncts = puncts.unwrap_or_else(|| smallvec![*punct]);
255 255
256 Some(crate::Separator::Puncts(puncts)) 256 Some(crate::Separator::Puncts(puncts))
@@ -292,7 +292,7 @@ where
292 TokenPeek { iter: itertools::multipeek(iter) } 292 TokenPeek { iter: itertools::multipeek(iter) }
293 } 293 }
294 294
295 pub fn current_punct2(&mut self, p: &tt::Punct) -> Option<((char, char), bool)> { 295 pub fn current_punct2(&mut self, p: tt::Punct) -> Option<((char, char), bool)> {
296 if p.spacing != tt::Spacing::Joint { 296 if p.spacing != tt::Spacing::Joint {
297 return None; 297 return None;
298 } 298 }
@@ -302,7 +302,7 @@ where
302 Some(((p.char, p1.char), p1.spacing == tt::Spacing::Joint)) 302 Some(((p.char, p1.char), p1.spacing == tt::Spacing::Joint))
303 } 303 }
304 304
305 pub fn current_punct3(&mut self, p: &tt::Punct) -> Option<((char, char, char), bool)> { 305 pub fn current_punct3(&mut self, p: tt::Punct) -> Option<((char, char, char), bool)> {
306 self.current_punct2(p).and_then(|((p0, p1), last_joint)| { 306 self.current_punct2(p).and_then(|((p0, p1), last_joint)| {
307 if !last_joint { 307 if !last_joint {
308 None 308 None