about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDániel Buga <bugadani@gmail.com>2020-10-22 15:06:24 +0200
committerDániel Buga <bugadani@gmail.com>2020-11-13 11:19:25 +0100
commitf0d0d87a2002dea7365ce2230e2df2ed4786fcbe (patch)
tree24e9b52ce83a6ec6cc36e7fa0abac47725989cc4
parent45faeb43aecdc98c9e3f2b24edf2ecc71f39d323 (diff)
downloadrust-f0d0d87a2002dea7365ce2230e2df2ed4786fcbe.tar.gz
rust-f0d0d87a2002dea7365ce2230e2df2ed4786fcbe.zip
Push to result vector instead of allocating
Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs5
2 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
index d24e1f5d4dd..85dc60d7eed 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
@@ -415,7 +415,7 @@ impl CStore {
 
         let span = data.get_span(id.index, sess);
 
-        let attrs: Vec<_> = data.get_item_attrs(id.index, sess).collect();
+        let attrs = data.get_item_attrs(id.index, sess).collect();
 
         let ident = data.item_ident(id.index, sess);
 
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
index b0bfb4ad173..ea18a689065 100644
--- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
@@ -353,16 +353,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
             all_bounds.filter(|p| p.def_id() == stack.obligation.predicate.def_id());
 
         // Keep only those bounds which may apply, and propagate overflow if it occurs.
-        let mut param_candidates = vec![];
         for bound in matching_bounds {
             let wc = self.evaluate_where_clause(stack, bound)?;
             if wc.may_apply() {
-                param_candidates.push(ParamCandidate(bound));
+                candidates.vec.push(ParamCandidate(bound));
             }
         }
 
-        candidates.vec.extend(param_candidates);
-
         Ok(())
     }