diff options
author | Maan2003 <[email protected]> | 2021-06-13 04:57:19 +0100 |
---|---|---|
committer | Maan2003 <[email protected]> | 2021-06-13 04:57:19 +0100 |
commit | 705f7e6e2644bf5de4255bc05ea8d9d5027c29b0 (patch) | |
tree | 1bf26189989bb871a86ec4ee612c978be5e5f883 | |
parent | 6cc6dee9e96d55dbbd8593523551a9981a691147 (diff) |
clippy::clone_on_copy
-rw-r--r-- | crates/hir/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/hir_def/src/attr.rs | 2 | ||||
-rw-r--r-- | crates/hir_def/src/item_scope.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/proc_macro.rs | 1 | ||||
-rw-r--r-- | crates/ide/src/goto_definition.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/goto_implementation.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/hover.rs | 2 |
7 files changed, 6 insertions, 7 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index f6eb23262..bd923cba8 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -452,7 +452,7 @@ impl Module { | |||
452 | } | 452 | } |
453 | 453 | ||
454 | pub fn visibility_of(self, db: &dyn HirDatabase, def: &ModuleDef) -> Option<Visibility> { | 454 | pub fn visibility_of(self, db: &dyn HirDatabase, def: &ModuleDef) -> Option<Visibility> { |
455 | self.id.def_map(db.upcast())[self.id.local_id].scope.visibility_of(def.clone().into()) | 455 | self.id.def_map(db.upcast())[self.id.local_id].scope.visibility_of((*def).into()) |
456 | } | 456 | } |
457 | 457 | ||
458 | pub fn diagnostics( | 458 | pub fn diagnostics( |
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index d9f9fadc1..2b21cf927 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs | |||
@@ -606,7 +606,7 @@ pub struct DocsRangeMap { | |||
606 | impl DocsRangeMap { | 606 | impl DocsRangeMap { |
607 | pub fn map(&self, range: TextRange) -> Option<InFile<TextRange>> { | 607 | pub fn map(&self, range: TextRange) -> Option<InFile<TextRange>> { |
608 | let found = self.mapping.binary_search_by(|(probe, ..)| probe.ordering(range)).ok()?; | 608 | let found = self.mapping.binary_search_by(|(probe, ..)| probe.ordering(range)).ok()?; |
609 | let (line_docs_range, idx, original_line_src_range) = self.mapping[found].clone(); | 609 | let (line_docs_range, idx, original_line_src_range) = self.mapping[found]; |
610 | if !line_docs_range.contains_range(range) { | 610 | if !line_docs_range.contains_range(range) { |
611 | return None; | 611 | return None; |
612 | } | 612 | } |
diff --git a/crates/hir_def/src/item_scope.rs b/crates/hir_def/src/item_scope.rs index 0f74f050d..08407ebfa 100644 --- a/crates/hir_def/src/item_scope.rs +++ b/crates/hir_def/src/item_scope.rs | |||
@@ -59,7 +59,7 @@ pub struct ItemScope { | |||
59 | pub(crate) static BUILTIN_SCOPE: Lazy<FxHashMap<Name, PerNs>> = Lazy::new(|| { | 59 | pub(crate) static BUILTIN_SCOPE: Lazy<FxHashMap<Name, PerNs>> = Lazy::new(|| { |
60 | BuiltinType::ALL | 60 | BuiltinType::ALL |
61 | .iter() | 61 | .iter() |
62 | .map(|(name, ty)| (name.clone(), PerNs::types(ty.clone().into(), Visibility::Public))) | 62 | .map(|(name, ty)| (name.clone(), PerNs::types((*ty).into(), Visibility::Public))) |
63 | .collect() | 63 | .collect() |
64 | }); | 64 | }); |
65 | 65 | ||
diff --git a/crates/hir_expand/src/proc_macro.rs b/crates/hir_expand/src/proc_macro.rs index 3ad2d3bf7..025e10239 100644 --- a/crates/hir_expand/src/proc_macro.rs +++ b/crates/hir_expand/src/proc_macro.rs | |||
@@ -45,7 +45,6 @@ impl ProcMacroExpander { | |||
45 | let proc_macro = krate_graph[self.krate] | 45 | let proc_macro = krate_graph[self.krate] |
46 | .proc_macro | 46 | .proc_macro |
47 | .get(id.0 as usize) | 47 | .get(id.0 as usize) |
48 | .clone() | ||
49 | .ok_or_else(|| err!("No derive macro found."))?; | 48 | .ok_or_else(|| err!("No derive macro found."))?; |
50 | 49 | ||
51 | // Proc macros have access to the environment variables of the invoking crate. | 50 | // Proc macros have access to the environment variables of the invoking crate. |
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( | |||
43 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; | 43 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; |
44 | let (_, link, ns) = | 44 | let (_, link, ns) = |
45 | extract_definitions_from_markdown(docs.as_str()).into_iter().find(|(range, ..)| { | 45 | extract_definitions_from_markdown(docs.as_str()).into_iter().find(|(range, ..)| { |
46 | doc_mapping.map(range.clone()).map_or(false, |InFile { file_id, value: range }| { | 46 | doc_mapping.map(*range).map_or(false, |InFile { file_id, value: range }| { |
47 | file_id == position.file_id.into() && range.contains(position.offset) | 47 | file_id == position.file_id.into() && range.contains(position.offset) |
48 | }) | 48 | }) |
49 | })?; | 49 | })?; |
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( | |||
87 | .filter_map(|imp| { | 87 | .filter_map(|imp| { |
88 | let item = imp.items(sema.db).iter().find_map(|itm| { | 88 | let item = imp.items(sema.db).iter().find_map(|itm| { |
89 | let itm_name = itm.name(sema.db)?; | 89 | let itm_name = itm.name(sema.db)?; |
90 | (itm_name == fun_name).then(|| itm.clone()) | 90 | (itm_name == fun_name).then(|| *itm) |
91 | })?; | 91 | })?; |
92 | item.try_to_nav(sema.db) | 92 | item.try_to_nav(sema.db) |
93 | }) | 93 | }) |
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( | |||
131 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; | 131 | let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?; |
132 | let (idl_range, link, ns) = | 132 | let (idl_range, link, ns) = |
133 | extract_definitions_from_markdown(docs.as_str()).into_iter().find_map(|(range, link, ns)| { | 133 | extract_definitions_from_markdown(docs.as_str()).into_iter().find_map(|(range, link, ns)| { |
134 | let InFile { file_id, value: range } = doc_mapping.map(range.clone())?; | 134 | let InFile { file_id, value: range } = doc_mapping.map(range)?; |
135 | if file_id == position.file_id.into() && range.contains(position.offset) { | 135 | if file_id == position.file_id.into() && range.contains(position.offset) { |
136 | Some((range, link, ns)) | 136 | Some((range, link, ns)) |
137 | } else { | 137 | } else { |