]> git.lizzy.rs Git - rust.git/commitdiff
Push to result vector instead of allocating
authorDániel Buga <bugadani@gmail.com>
Thu, 22 Oct 2020 13:06:24 +0000 (15:06 +0200)
committerDániel Buga <bugadani@gmail.com>
Fri, 13 Nov 2020 10:19:25 +0000 (11:19 +0100)
Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

index d24e1f5d4dd06dec072b287458e78d53f4f2fad4..85dc60d7eed6d57b61745fdca12410b0207ce7c8 100644 (file)
@@ -415,7 +415,7 @@ pub fn load_macro_untracked(&self, id: DefId, sess: &Session) -> LoadedMacro {
 
         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);
 
index b0bfb4ad173719c791a3f228f87997aac1c11a50..ea18a689065e30adc5462fde012afbdabf261dc3 100644 (file)
@@ -353,16 +353,13 @@ fn assemble_candidates_from_caller_bounds<'o>(
             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(())
     }