mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-15 22:54:00 +00:00
avoid 'cloning' types that implement 'Copy'
This commit is contained in:
parent
3987c835f2
commit
95d14c393c
6 changed files with 7 additions and 7 deletions
|
@ -1931,7 +1931,7 @@ pub(crate) fn const_or_path_to_chalk(
|
|||
debruijn: DebruijnIndex,
|
||||
) -> Const {
|
||||
match value {
|
||||
ConstScalarOrPath::Scalar(s) => intern_const_scalar(s.clone(), expected_ty),
|
||||
ConstScalarOrPath::Scalar(s) => intern_const_scalar(*s, expected_ty),
|
||||
ConstScalarOrPath::Path(n) => {
|
||||
let path = ModPath::from_segments(PathKind::Plain, Some(n.clone()));
|
||||
path_to_const(db, resolver, &path, mode, args, debruijn)
|
||||
|
|
|
@ -923,7 +923,7 @@ impl Struct {
|
|||
}
|
||||
|
||||
pub fn repr(self, db: &dyn HirDatabase) -> Option<ReprOptions> {
|
||||
db.struct_data(self.id).repr.clone()
|
||||
db.struct_data(self.id).repr
|
||||
}
|
||||
|
||||
pub fn kind(self, db: &dyn HirDatabase) -> StructKind {
|
||||
|
|
|
@ -145,7 +145,7 @@ fn invocation_fixtures(rules: &FxHashMap<String, DeclarativeMacro>) -> Vec<(Stri
|
|||
Op::Ident(it) => parent.token_trees.push(tt::Leaf::from(it.clone()).into()),
|
||||
Op::Punct(puncts) => {
|
||||
for punct in puncts {
|
||||
parent.token_trees.push(tt::Leaf::from(punct.clone()).into());
|
||||
parent.token_trees.push(tt::Leaf::from(*punct).into());
|
||||
}
|
||||
}
|
||||
Op::Repeat { tokens, kind, separator } => {
|
||||
|
|
|
@ -138,7 +138,7 @@ fn expand_subtree(
|
|||
Op::Ident(it) => arena.push(tt::Leaf::from(it.clone()).into()),
|
||||
Op::Punct(puncts) => {
|
||||
for punct in puncts {
|
||||
arena.push(tt::Leaf::from(punct.clone()).into());
|
||||
arena.push(tt::Leaf::from(*punct).into());
|
||||
}
|
||||
}
|
||||
Op::Subtree { tokens, delimiter } => {
|
||||
|
|
|
@ -126,7 +126,7 @@ fn next_op(
|
|||
src.next().expect("first token already peeked");
|
||||
// Note that the '$' itself is a valid token inside macro_rules.
|
||||
let second = match src.next() {
|
||||
None => return Ok(Op::Punct(smallvec![p.clone()])),
|
||||
None => return Ok(Op::Punct(smallvec![*p])),
|
||||
Some(it) => it,
|
||||
};
|
||||
match second {
|
||||
|
|
|
@ -114,7 +114,7 @@ impl<'a> TtIter<'a> {
|
|||
('.', '.', Some('.' | '=')) | ('<', '<', Some('=')) | ('>', '>', Some('=')) => {
|
||||
let _ = self.next().unwrap();
|
||||
let _ = self.next().unwrap();
|
||||
Ok(smallvec![first, second.clone(), third.unwrap().clone()])
|
||||
Ok(smallvec![first, *second, *third.unwrap()])
|
||||
}
|
||||
('-' | '!' | '*' | '/' | '&' | '%' | '^' | '+' | '<' | '=' | '>' | '|', '=', _)
|
||||
| ('-' | '=' | '>', '>', _)
|
||||
|
@ -125,7 +125,7 @@ impl<'a> TtIter<'a> {
|
|||
| ('<', '<', _)
|
||||
| ('|', '|', _) => {
|
||||
let _ = self.next().unwrap();
|
||||
Ok(smallvec![first, second.clone()])
|
||||
Ok(smallvec![first, *second])
|
||||
}
|
||||
_ => Ok(smallvec![first]),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue