Fix clippy::redundant_clone

This commit is contained in:
Shotaro Yamada 2019-07-05 12:41:53 +09:00
parent 21f70a7293
commit d0e9cd2bc6
4 changed files with 5 additions and 6 deletions

View File

@ -169,7 +169,7 @@ impl ModuleSource {
(None, Some(item_id)) => { (None, Some(item_id)) => {
let module = item_id.to_node(db); let module = item_id.to_node(db);
assert!(module.item_list().is_some(), "expected inline module"); assert!(module.item_list().is_some(), "expected inline module");
ModuleSource::Module(module.to_owned()) ModuleSource::Module(module)
} }
(None, None) => panic!(), (None, None) => panic!(),
} }

View File

@ -895,8 +895,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
} }
None => (receiver_ty, Ty::Unknown, None), None => (receiver_ty, Ty::Unknown, None),
}; };
let substs = let substs = self.substs_for_method_call(def_generics, generic_args, &derefed_receiver_ty);
self.substs_for_method_call(def_generics.clone(), generic_args, &derefed_receiver_ty);
let method_ty = method_ty.apply_substs(substs); let method_ty = method_ty.apply_substs(substs);
let method_ty = self.insert_type_vars(method_ty); let method_ty = self.insert_type_vars(method_ty);
self.register_obligations_for_call(&method_ty); self.register_obligations_for_call(&method_ty);

View File

@ -88,7 +88,7 @@ impl HoverResult {
fn hover_text(docs: Option<String>, desc: Option<String>) -> Option<String> { fn hover_text(docs: Option<String>, desc: Option<String>) -> Option<String> {
match (desc, docs) { match (desc, docs) {
(Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)), (Some(desc), docs) => Some(rust_code_markup_with_doc(desc, docs)),
(None, Some(docs)) => Some(docs.to_string()), (None, Some(docs)) => Some(docs),
_ => None, _ => None,
} }
} }

View File

@ -62,13 +62,13 @@ impl MockAnalysis {
pub fn add_file_with_position(&mut self, path: &str, text: &str) -> FilePosition { pub fn add_file_with_position(&mut self, path: &str, text: &str) -> FilePosition {
let (offset, text) = extract_offset(text); let (offset, text) = extract_offset(text);
let file_id = FileId((self.files.len() + 1) as u32); let file_id = FileId((self.files.len() + 1) as u32);
self.files.push((path.to_string(), text.to_string())); self.files.push((path.to_string(), text));
FilePosition { file_id, offset } FilePosition { file_id, offset }
} }
pub fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange { pub fn add_file_with_range(&mut self, path: &str, text: &str) -> FileRange {
let (range, text) = extract_range(text); let (range, text) = extract_range(text);
let file_id = FileId((self.files.len() + 1) as u32); let file_id = FileId((self.files.len() + 1) as u32);
self.files.push((path.to_string(), text.to_string())); self.files.push((path.to_string(), text));
FileRange { file_id, range } FileRange { file_id, range }
} }
pub fn id_of(&self, path: &str) -> FileId { pub fn id_of(&self, path: &str) -> FileId {