Skip to content

Commit 9452dfa

Browse files
committed
NFC: remove redundant clones (clippy::perf)
1 parent 23b48d3 commit 9452dfa

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

crates/hir_def/src/item_tree/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'a> Ctx<'a> {
130130
ast::Item::ExternBlock(ast) => self.lower_extern_block(ast).into(),
131131
};
132132

133-
self.add_attrs(item.into(), attrs.clone());
133+
self.add_attrs(item.into(), attrs);
134134

135135
Some(item)
136136
}

crates/ide_assists/src/handlers/extract_type_alias.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(crate) fn extract_type_alias(acc: &mut Assists, ctx: &AssistContext) -> Opti
3131
let item = ctx.find_node_at_offset::<ast::Item>()?;
3232
let insert = match_ast! {
3333
match (item.syntax().parent()?) {
34-
ast::AssocItemList(it) => it.syntax().parent()?.clone(),
34+
ast::AssocItemList(it) => it.syntax().parent()?,
3535
_ => item.syntax().clone(),
3636
}
3737
};

crates/ide_completion/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ impl<'a> CompletionContext<'a> {
567567
None => return,
568568
};
569569

570-
if let Some(segment) = ast::PathSegment::cast(parent.clone()) {
570+
if let Some(segment) = ast::PathSegment::cast(parent) {
571571
let path = segment.parent_path();
572572
self.is_call = path
573573
.syntax()

crates/proc_macro_api/src/msg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn read_json<'a>(
9292

9393
// Some ill behaved macro try to use stdout for debugging
9494
// We ignore it here
95-
if !buf.starts_with("{") {
95+
if !buf.starts_with('{') {
9696
log::error!("proc-macro tried to print : {}", buf);
9797
continue;
9898
}

crates/rust-analyzer/src/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ fn run_rustfmt(
16401640
.into());
16411641
}
16421642

1643-
let frange = from_proto::file_range(&snap, text_document.clone(), range)?;
1643+
let frange = from_proto::file_range(&snap, text_document, range)?;
16441644
let start_line = line_index.index.line_col(frange.range.start()).line;
16451645
let end_line = line_index.index.line_col(frange.range.end()).line;
16461646

0 commit comments

Comments
 (0)