diff options
author | kjeremy <[email protected]> | 2020-07-06 22:13:55 +0100 |
---|---|---|
committer | kjeremy <[email protected]> | 2020-07-06 22:13:55 +0100 |
commit | ebdee366b0e16d1d019db2f5c22a730b4451194f (patch) | |
tree | b7a052c076ecf5c7a21824693da85b8f3bc970d8 /crates | |
parent | d4bc2f25de6297c75f7b7f029df224b650ef3143 (diff) |
Clippy perf warnings
Removes redundant clones
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_ty/src/display.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/lower.rs | 3 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 8 | ||||
-rw-r--r-- | crates/test_utils/src/fixture.rs | 2 |
6 files changed, 9 insertions, 16 deletions
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/ra_hir_ty/src/display.rs index 23cea1a2a..ac68c5661 100644 --- a/crates/ra_hir_ty/src/display.rs +++ b/crates/ra_hir_ty/src/display.rs | |||
@@ -369,7 +369,7 @@ impl HirDisplay for ApplicationTy { | |||
369 | let data = (*datas) | 369 | let data = (*datas) |
370 | .as_ref() | 370 | .as_ref() |
371 | .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); | 371 | .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); |
372 | data.clone().subst(&self.parameters) | 372 | data.subst(&self.parameters) |
373 | } | 373 | } |
374 | }; | 374 | }; |
375 | write!(f, "impl ")?; | 375 | write!(f, "impl ")?; |
@@ -456,7 +456,7 @@ impl HirDisplay for Ty { | |||
456 | let data = (*datas) | 456 | let data = (*datas) |
457 | .as_ref() | 457 | .as_ref() |
458 | .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); | 458 | .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); |
459 | data.clone().subst(&opaque_ty.parameters) | 459 | data.subst(&opaque_ty.parameters) |
460 | } | 460 | } |
461 | }; | 461 | }; |
462 | write!(f, "impl ")?; | 462 | write!(f, "impl ")?; |
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index 22884522a..06baac2a9 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs | |||
@@ -85,10 +85,8 @@ impl<'a> InferenceContext<'a> { | |||
85 | ctor: TypeCtor::Tuple { cardinality: num_args as u16 }, | 85 | ctor: TypeCtor::Tuple { cardinality: num_args as u16 }, |
86 | parameters, | 86 | parameters, |
87 | }); | 87 | }); |
88 | let substs = Substs::build_for_generics(&generic_params) | 88 | let substs = |
89 | .push(ty.clone()) | 89 | Substs::build_for_generics(&generic_params).push(ty.clone()).push(arg_ty).build(); |
90 | .push(arg_ty.clone()) | ||
91 | .build(); | ||
92 | 90 | ||
93 | let trait_env = Arc::clone(&self.trait_env); | 91 | let trait_env = Arc::clone(&self.trait_env); |
94 | let implements_fn_trait = | 92 | let implements_fn_trait = |
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index 7f3f5e771..c12bed4af 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs | |||
@@ -891,7 +891,7 @@ impl Ty { | |||
891 | let data = (*it) | 891 | let data = (*it) |
892 | .as_ref() | 892 | .as_ref() |
893 | .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); | 893 | .map(|rpit| rpit.impl_traits[idx as usize].bounds.clone()); |
894 | data.clone().subst(&opaque_ty.parameters) | 894 | data.subst(&opaque_ty.parameters) |
895 | }) | 895 | }) |
896 | } | 896 | } |
897 | }; | 897 | }; |
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs index 3dc154e92..01af3187b 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/ra_hir_ty/src/lower.rs | |||
@@ -720,8 +720,7 @@ fn assoc_type_bindings_from_type_bound<'a>( | |||
720 | None => return SmallVec::<[GenericPredicate; 1]>::new(), | 720 | None => return SmallVec::<[GenericPredicate; 1]>::new(), |
721 | Some(t) => t, | 721 | Some(t) => t, |
722 | }; | 722 | }; |
723 | let projection_ty = | 723 | let projection_ty = ProjectionTy { associated_ty, parameters: super_trait_ref.substs }; |
724 | ProjectionTy { associated_ty, parameters: super_trait_ref.substs.clone() }; | ||
725 | let mut preds = SmallVec::with_capacity( | 724 | let mut preds = SmallVec::with_capacity( |
726 | binding.type_ref.as_ref().map_or(0, |_| 1) + binding.bounds.len(), | 725 | binding.type_ref.as_ref().map_or(0, |_| 1) + binding.bounds.len(), |
727 | ); | 726 | ); |
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 2ef173a03..940c30c7f 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -299,12 +299,8 @@ impl ast::UseTree { | |||
299 | Some(it) => it, | 299 | Some(it) => it, |
300 | None => return self.clone(), | 300 | None => return self.clone(), |
301 | }; | 301 | }; |
302 | let use_tree = make::use_tree( | 302 | let use_tree = |
303 | suffix.clone(), | 303 | make::use_tree(suffix, self.use_tree_list(), self.alias(), self.star_token().is_some()); |
304 | self.use_tree_list(), | ||
305 | self.alias(), | ||
306 | self.star_token().is_some(), | ||
307 | ); | ||
308 | let nested = make::use_tree_list(iter::once(use_tree)); | 304 | let nested = make::use_tree_list(iter::once(use_tree)); |
309 | return make::use_tree(prefix.clone(), Some(nested), None, false); | 305 | return make::use_tree(prefix.clone(), Some(nested), None, false); |
310 | 306 | ||
diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index fad8f7e2c..ed764046b 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs | |||
@@ -62,7 +62,7 @@ impl Fixture { | |||
62 | let components = meta.split_ascii_whitespace().collect::<Vec<_>>(); | 62 | let components = meta.split_ascii_whitespace().collect::<Vec<_>>(); |
63 | 63 | ||
64 | let path = components[0].to_string(); | 64 | let path = components[0].to_string(); |
65 | assert!(path.starts_with("/")); | 65 | assert!(path.starts_with('/')); |
66 | 66 | ||
67 | let mut krate = None; | 67 | let mut krate = None; |
68 | let mut deps = Vec::new(); | 68 | let mut deps = Vec::new(); |