From 3fc344b9f16ad481e87198da72052dd7ddfc88be Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 20 May 2019 17:48:58 +0800 Subject: Use normal iteration instead of walk_mut --- crates/ra_hir/src/ty/lower.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index b4496789b..8a8cc2a24 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs @@ -206,23 +206,20 @@ pub(super) fn substs_from_path_segment( substs.push(Ty::Unknown); } assert_eq!(substs.len(), def_generics.count_params_including_parent()); - let mut substs = Substs(substs.into()); // handle defaults if let Some(def_generic) = def_generic { let default_substs = db.generic_defaults(def_generic); assert_eq!(substs.len(), default_substs.len()); - let mut i = 0; - substs.walk_mut(&mut |ty| { - if *ty == Ty::Unknown { - *ty = default_substs[i].clone(); + for (i, default_ty) in default_substs.iter().enumerate() { + if substs[i] == Ty::Unknown { + substs[i] = default_ty.clone(); } - i += 1; - }); + } } - substs + Substs(substs.into()) } impl TraitRef { -- cgit v1.2.3