9129: NFC: remove redundant clones (clippy::perf) r=Veykril a=matthiaskrgr



Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
This commit is contained in:
bors[bot] 2021-06-03 13:45:17 +00:00 committed by GitHub
commit 1dbdac8f51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View file

@ -130,7 +130,7 @@ impl<'a> Ctx<'a> {
ast::Item::ExternBlock(ast) => self.lower_extern_block(ast).into(),
};
self.add_attrs(item.into(), attrs.clone());
self.add_attrs(item.into(), attrs);
Some(item)
}

View file

@ -31,7 +31,7 @@ pub(crate) fn extract_type_alias(acc: &mut Assists, ctx: &AssistContext) -> Opti
let item = ctx.find_node_at_offset::<ast::Item>()?;
let insert = match_ast! {
match (item.syntax().parent()?) {
ast::AssocItemList(it) => it.syntax().parent()?.clone(),
ast::AssocItemList(it) => it.syntax().parent()?,
_ => item.syntax().clone(),
}
};

View file

@ -567,7 +567,7 @@ impl<'a> CompletionContext<'a> {
None => return,
};
if let Some(segment) = ast::PathSegment::cast(parent.clone()) {
if let Some(segment) = ast::PathSegment::cast(parent) {
let path = segment.parent_path();
self.is_call = path
.syntax()

View file

@ -92,7 +92,7 @@ fn read_json<'a>(
// Some ill behaved macro try to use stdout for debugging
// We ignore it here
if !buf.starts_with("{") {
if !buf.starts_with('{') {
log::error!("proc-macro tried to print : {}", buf);
continue;
}

View file

@ -1640,7 +1640,7 @@ fn run_rustfmt(
.into());
}
let frange = from_proto::file_range(&snap, text_document.clone(), range)?;
let frange = from_proto::file_range(&snap, text_document, range)?;
let start_line = line_index.index.line_col(frange.range.start()).line;
let end_line = line_index.index.line_col(frange.range.end()).line;