aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/tt_cursor.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-05 17:07:11 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-05 17:07:11 +0100
commitfeae74e02c4ed0a134b6d3f18dd5d79baff85c3d (patch)
treefacf2c398e8dd428225a84455437abf81a478ee0 /crates/ra_mbe/src/tt_cursor.rs
parentec6f71576ace170fd306a68f77e5c5e9646d15be (diff)
parent001e34e6e31503195d176a349bc9476681c79e7f (diff)
Merge #1493
1493: Clippy trivially_copy_pass_by_ref r=matklad a=kjeremy Clippy says that this is more efficient. Co-authored-by: Jeremy Kolb <[email protected]>
Diffstat (limited to 'crates/ra_mbe/src/tt_cursor.rs')
-rw-r--r--crates/ra_mbe/src/tt_cursor.rs16
1 files changed, 8 insertions, 8 deletions
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