From 76d688a328ab53b6264f9e489b88524377a7271d Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 20 Dec 2019 03:04:55 +0800 Subject: Use fill instread of for loop --- crates/ra_hir_ty/src/infer.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index 98baeed6f..bbbc391c4 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs @@ -375,11 +375,9 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { match assoc_ty { Some(res_assoc_ty) => { let ty = self.table.new_type_var(); - let mut builder = Substs::build_for_def(self.db, res_assoc_ty).push(inner_ty); - for ty in params { - builder = builder.push(ty.clone()); - } - + let builder = Substs::build_for_def(self.db, res_assoc_ty) + .push(inner_ty) + .fill(params.iter().cloned()); let projection = ProjectionPredicate { ty: ty.clone(), projection_ty: ProjectionTy { -- cgit v1.2.3