aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-05-20 10:48:58 +0100
committerEdwin Cheng <[email protected]>2019-05-20 10:48:58 +0100
commit3fc344b9f16ad481e87198da72052dd7ddfc88be (patch)
tree2a2f4702846c34cb96fe278e1860d362cdaff151 /crates/ra_hir/src/ty
parentd4dc8794159fbee10fcfe78d5da3a7bf41d7f4f6 (diff)
Use normal iteration instead of walk_mut
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/lower.rs13
1 files changed, 5 insertions, 8 deletions
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(
206 substs.push(Ty::Unknown); 206 substs.push(Ty::Unknown);
207 } 207 }
208 assert_eq!(substs.len(), def_generics.count_params_including_parent()); 208 assert_eq!(substs.len(), def_generics.count_params_including_parent());
209 let mut substs = Substs(substs.into());
210 209
211 // handle defaults 210 // handle defaults
212 if let Some(def_generic) = def_generic { 211 if let Some(def_generic) = def_generic {
213 let default_substs = db.generic_defaults(def_generic); 212 let default_substs = db.generic_defaults(def_generic);
214 assert_eq!(substs.len(), default_substs.len()); 213 assert_eq!(substs.len(), default_substs.len());
215 214
216 let mut i = 0; 215 for (i, default_ty) in default_substs.iter().enumerate() {
217 substs.walk_mut(&mut |ty| { 216 if substs[i] == Ty::Unknown {
218 if *ty == Ty::Unknown { 217 substs[i] = default_ty.clone();
219 *ty = default_substs[i].clone();
220 } 218 }
221 i += 1; 219 }
222 });
223 } 220 }
224 221
225 substs 222 Substs(substs.into())
226} 223}
227 224
228impl TraitRef { 225impl TraitRef {