Merge #7574
7574: Remove various redundant clones r=kjeremy a=yoshuawuyts I noticed when running clippy through RA that there are a few instances where `clone` is called where it's not actually needed. I figured a small patch to remove these might be welcome here. Thanks! Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
This commit is contained in:
commit
737e7a7b75
@ -162,7 +162,7 @@ fn add_impl(&mut self, mut assist: Assist, f: impl FnOnce(&mut AssistBuilder)) -
|
||||
} else {
|
||||
None
|
||||
};
|
||||
assist.source_change = source_change.clone();
|
||||
assist.source_change = source_change;
|
||||
|
||||
self.buf.push(assist);
|
||||
Some(())
|
||||
@ -242,7 +242,7 @@ pub(crate) fn rewrite(&mut self, rewriter: SyntaxRewriter) {
|
||||
}
|
||||
pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>) {
|
||||
let file_system_edit =
|
||||
FileSystemEdit::CreateFile { dst: dst.clone(), initial_contents: content.into() };
|
||||
FileSystemEdit::CreateFile { dst: dst, initial_contents: content.into() };
|
||||
self.source_change.push_file_system_edit(file_system_edit);
|
||||
}
|
||||
|
||||
|
@ -712,7 +712,7 @@ fn collect_block(&mut self, block: ast::BlockExpr) -> ExprId {
|
||||
let statements =
|
||||
block.statements().filter_map(|s| self.collect_stmt(s)).flatten().collect();
|
||||
let tail = block.tail_expr().map(|e| self.collect_expr(e));
|
||||
let syntax_node_ptr = AstPtr::new(&block.clone().into());
|
||||
let syntax_node_ptr = AstPtr::new(&block.into());
|
||||
let expr_id = self.alloc_expr(
|
||||
Expr::Block { id: block_id, statements, tail, label: None },
|
||||
syntax_node_ptr,
|
||||
|
@ -43,7 +43,7 @@ pub(crate) fn fn_data_query(db: &dyn DefDatabase, func: FunctionId) -> Arc<Funct
|
||||
name: func.name.clone(),
|
||||
params: func.params.iter().map(|id| item_tree[*id].clone()).collect(),
|
||||
ret_type: item_tree[func.ret_type].clone(),
|
||||
attrs: item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()).clone(),
|
||||
attrs: item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()),
|
||||
has_self_param: func.has_self_param,
|
||||
has_body: func.has_body,
|
||||
is_unsafe: func.is_unsafe,
|
||||
|
@ -161,7 +161,7 @@ pub(crate) fn check_diagnostics(&self) {
|
||||
let node = src.map(|ptr| ptr.to_node(&root));
|
||||
let frange = node.as_ref().original_file_range(db);
|
||||
|
||||
let message = d.message().to_owned();
|
||||
let message = d.message();
|
||||
actual.entry(frange.file_id).or_default().push((frange.range, message));
|
||||
});
|
||||
|
||||
|
@ -511,7 +511,7 @@ pub(crate) fn check_diagnostics(ra_fixture: &str) {
|
||||
// FIXME: macros...
|
||||
let file_id = src.file_id.original_file(&db);
|
||||
let range = src.value.to_node(&root).text_range();
|
||||
let message = d.message().to_owned();
|
||||
let message = d.message();
|
||||
actual.entry(file_id).or_default().push((range, message));
|
||||
});
|
||||
|
||||
|
@ -262,7 +262,7 @@ fn test_proc_macro_rpc_works() {
|
||||
|
||||
assert_eq!(task.macro_body, back.macro_body);
|
||||
|
||||
let result = ExpansionResult { expansion: tt.clone() };
|
||||
let result = ExpansionResult { expansion: tt };
|
||||
let json = serde_json::to_string(&result).unwrap();
|
||||
let back: ExpansionResult = serde_json::from_str(&json).unwrap();
|
||||
|
||||
|
@ -95,16 +95,7 @@ fn parse_meta_line(meta: &str) -> Fixture {
|
||||
}
|
||||
}
|
||||
|
||||
Fixture {
|
||||
path,
|
||||
text: String::new(),
|
||||
krate: krate,
|
||||
deps,
|
||||
cfg_atoms,
|
||||
cfg_key_values,
|
||||
edition,
|
||||
env,
|
||||
}
|
||||
Fixture { path, text: String::new(), krate, deps, cfg_atoms, cfg_key_values, edition, env }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user