remove more redundant clones (clippy::redundant_clone())

This commit is contained in:
Matthias Krüger 2021-03-21 12:05:08 +01:00
parent 0d40ff5e62
commit 3d9b3a8575
5 changed files with 6 additions and 7 deletions

View File

@ -472,7 +472,7 @@ fn process_names(&self, db: &dyn DefDatabase, f: &mut dyn FnMut(Name, ScopeDef))
}
Scope::ExprScope(scope) => {
if let Some((label, name)) = scope.expr_scopes.label(scope.scope_id) {
f(name.clone(), ScopeDef::Label(label))
f(name, ScopeDef::Label(label))
}
scope.expr_scopes.entries(scope.scope_id).iter().for_each(|e| {
f(e.name().clone(), ScopeDef::Local(e.pat()));

View File

@ -173,7 +173,7 @@ fn macro_arg_text(db: &dyn AstDatabase, id: MacroCallId) -> Option<GreenNode> {
};
let loc = db.lookup_intern_macro(id);
let arg = loc.kind.arg(db)?;
Some(arg.green().to_owned())
Some(arg.green())
}
fn macro_arg(db: &dyn AstDatabase, id: MacroCallId) -> Option<Arc<(tt::Subtree, mbe::TokenMap)>> {

View File

@ -946,8 +946,7 @@ pub(crate) fn trait_environment_query(
let substs = Substitution::type_params(db, trait_id);
let trait_ref = TraitRef { trait_id: to_chalk_trait_id(trait_id), substitution: substs };
let pred = WhereClause::Implemented(trait_ref);
let program_clause: chalk_ir::ProgramClause<Interner> =
pred.clone().to_chalk(db).cast(&Interner);
let program_clause: chalk_ir::ProgramClause<Interner> = pred.to_chalk(db).cast(&Interner);
clauses.push(program_clause.into_from_env_clause(&Interner));
}

View File

@ -567,7 +567,7 @@ fn rewrite_self(
fn element_to_green(element: SyntaxElement) -> NodeOrToken<rowan::GreenNode, rowan::GreenToken> {
match element {
NodeOrToken::Node(it) => NodeOrToken::Node(it.green().to_owned()),
NodeOrToken::Node(it) => NodeOrToken::Node(it.green()),
NodeOrToken::Token(it) => NodeOrToken::Token(it.green().to_owned()),
}
}
@ -625,7 +625,7 @@ fn position_of_child(parent: &SyntaxNode, child: SyntaxElement) -> usize {
fn to_green_element(element: SyntaxElement) -> NodeOrToken<rowan::GreenNode, rowan::GreenToken> {
match element {
NodeOrToken::Node(it) => it.green().to_owned().into(),
NodeOrToken::Node(it) => it.green().into(),
NodeOrToken::Token(it) => it.green().to_owned().into(),
}
}

View File

@ -532,7 +532,7 @@ fn ast_from_text<N: AstNode>(text: &str) -> N {
}
fn unroot(n: SyntaxNode) -> SyntaxNode {
SyntaxNode::new_root(n.green().to_owned())
SyntaxNode::new_root(n.green())
}
pub mod tokens {