From 705f7e6e2644bf5de4255bc05ea8d9d5027c29b0 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:27:19 +0530 Subject: clippy::clone_on_copy --- crates/ide/src/goto_definition.rs | 2 +- crates/ide/src/goto_implementation.rs | 2 +- crates/ide/src/hover.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ide/src') diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 27a292d83..d29ee64a5 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -43,7 +43,7 @@ pub(crate) fn goto_definition( let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; let (_, link, ns) = extract_definitions_from_markdown(docs.as_str()).into_iter().find(|(range, ..)| { - doc_mapping.map(range.clone()).map_or(false, |InFile { file_id, value: range }| { + doc_mapping.map(*range).map_or(false, |InFile { file_id, value: range }| { file_id == position.file_id.into() && range.contains(position.offset) }) })?; diff --git a/crates/ide/src/goto_implementation.rs b/crates/ide/src/goto_implementation.rs index 95fd39850..0013820b4 100644 --- a/crates/ide/src/goto_implementation.rs +++ b/crates/ide/src/goto_implementation.rs @@ -87,7 +87,7 @@ fn impls_for_trait_item( .filter_map(|imp| { let item = imp.items(sema.db).iter().find_map(|itm| { let itm_name = itm.name(sema.db)?; - (itm_name == fun_name).then(|| itm.clone()) + (itm_name == fun_name).then(|| *itm) })?; item.try_to_nav(sema.db) }) diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index b4b3b45b5..4ba4f61d8 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -131,7 +131,7 @@ pub(crate) fn hover( let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; let (idl_range, link, ns) = extract_definitions_from_markdown(docs.as_str()).into_iter().find_map(|(range, link, ns)| { - let InFile { file_id, value: range } = doc_mapping.map(range.clone())?; + let InFile { file_id, value: range } = doc_mapping.map(range)?; if file_id == position.file_id.into() && range.contains(position.offset) { Some((range, link, ns)) } else { -- cgit v1.2.3