Skip to content

Commit 3be2d1d

Browse files
bors[bot]sinkuu
andcommitted
Merge #1492
1492: Fix clippy::redundant_clone r=matklad a=sinkuu Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2 parents 21f70a7 + d0e9cd2 commit 3be2d1d

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

crates/ra_hir/src/code_model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl ModuleSource {
169169
(None, Some(item_id)) => {
170170
let module = item_id.to_node(db);
171171
assert!(module.item_list().is_some(), "expected inline module");
172-
ModuleSource::Module(module.to_owned())
172+
ModuleSource::Module(module)
173173
}
174174
(None, None) => panic!(),
175175
}

crates/ra_hir/src/ty/infer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
895895
}
896896
None => (receiver_ty, Ty::Unknown, None),
897897
};
898-
let substs =
899-
self.substs_for_method_call(def_generics.clone(), generic_args, &derefed_receiver_ty);
898+
let substs = self.substs_for_method_call(def_generics, generic_args, &derefed_receiver_ty);
900899
let method_ty = method_ty.apply_substs(substs);
901900
let method_ty = self.insert_type_vars(method_ty);
902901
self.register_obligations_for_call(&method_ty);

crates/ra_ide_api/src/hover.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl HoverResult {
8888
fn hover_text(docs: Option<String>, desc: Option<String>) -> Option<String> {
8989
match (desc, docs) {
9090
(Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)),
91-
(None, Some(docs)) => Some(docs.to_string()),
91+
(None, Some(docs)) => Some(docs),
9292
_ => None,
9393
}
9494
}

crates/ra_ide_api/src/mock_analysis.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ impl MockAnalysis {
6262
pub fn add_file_with_position(&mut self, path: &str, text: &str) -> FilePosition {
6363
let (offset, text) = extract_offset(text);
6464
let file_id = FileId((self.files.len() + 1) as u32);
65-
self.files.push((path.to_string(), text.to_string()));
65+
self.files.push((path.to_string(), text));
6666
FilePosition { file_id, offset }
6767
}
6868
pub fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange {
6969
let (range, text) = extract_range(text);
7070
let file_id = FileId((self.files.len() + 1) as u32);
71-
self.files.push((path.to_string(), text.to_string()));
71+
self.files.push((path.to_string(), text));
7272
FileRange { file_id, range }
7373
}
7474
pub fn id_of(&self, path: &str) -> FileId {

0 commit comments

Comments
 (0)