mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Clippy trivially_copy_pass_by_ref
This commit is contained in:
parent
ec6f71576a
commit
001e34e6e3
11 changed files with 30 additions and 30 deletions
|
@ -145,7 +145,7 @@ fn convert_ident(ident: &tt::Ident) -> TtToken {
|
|||
TtToken { kind, is_joint_to_next: false, text: ident.text.clone() }
|
||||
}
|
||||
|
||||
fn convert_punct(p: &tt::Punct) -> TtToken {
|
||||
fn convert_punct(p: tt::Punct) -> TtToken {
|
||||
let kind = match p.char {
|
||||
// lexer may produce compound tokens for these ones
|
||||
'.' => T![.],
|
||||
|
@ -167,6 +167,6 @@ fn convert_leaf(leaf: &tt::Leaf) -> TtToken {
|
|||
match leaf {
|
||||
tt::Leaf::Literal(l) => convert_literal(l),
|
||||
tt::Leaf::Ident(ident) => convert_ident(ident),
|
||||
tt::Leaf::Punct(punct) => convert_punct(punct),
|
||||
tt::Leaf::Punct(punct) => convert_punct(*punct),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,20 +170,20 @@ impl<'a> TtCursor<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn eat_punct3(&mut self, p: &tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> {
|
||||
fn eat_punct3(&mut self, p: tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> {
|
||||
let sec = *self.eat_punct()?;
|
||||
let third = *self.eat_punct()?;
|
||||
Some(smallvec![*p, sec, third])
|
||||
Some(smallvec![p, sec, third])
|
||||
}
|
||||
|
||||
fn eat_punct2(&mut self, p: &tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> {
|
||||
fn eat_punct2(&mut self, p: tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> {
|
||||
let sec = *self.eat_punct()?;
|
||||
Some(smallvec![*p, sec])
|
||||
Some(smallvec![p, sec])
|
||||
}
|
||||
|
||||
fn eat_multi_char_punct<'b, I>(
|
||||
&mut self,
|
||||
p: &tt::Punct,
|
||||
p: tt::Punct,
|
||||
iter: &mut TokenPeek<'b, I>,
|
||||
) -> Option<SmallVec<[tt::Punct; 3]>>
|
||||
where
|
||||
|
@ -250,7 +250,7 @@ impl<'a> TtCursor<'a> {
|
|||
// But at this phase, some punct still is jointed.
|
||||
// So we by pass that check here.
|
||||
let mut peekable = TokenPeek::new(self.subtree.token_trees[self.pos..].iter());
|
||||
let puncts = self.eat_multi_char_punct(punct, &mut peekable);
|
||||
let puncts = self.eat_multi_char_punct(*punct, &mut peekable);
|
||||
let puncts = puncts.unwrap_or_else(|| smallvec![*punct]);
|
||||
|
||||
Some(crate::Separator::Puncts(puncts))
|
||||
|
@ -292,7 +292,7 @@ where
|
|||
TokenPeek { iter: itertools::multipeek(iter) }
|
||||
}
|
||||
|
||||
pub fn current_punct2(&mut self, p: &tt::Punct) -> Option<((char, char), bool)> {
|
||||
pub fn current_punct2(&mut self, p: tt::Punct) -> Option<((char, char), bool)> {
|
||||
if p.spacing != tt::Spacing::Joint {
|
||||
return None;
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ where
|
|||
Some(((p.char, p1.char), p1.spacing == tt::Spacing::Joint))
|
||||
}
|
||||
|
||||
pub fn current_punct3(&mut self, p: &tt::Punct) -> Option<((char, char, char), bool)> {
|
||||
pub fn current_punct3(&mut self, p: tt::Punct) -> Option<((char, char, char), bool)> {
|
||||
self.current_punct2(p).and_then(|((p0, p1), last_joint)| {
|
||||
if !last_joint {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue