aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/ty.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 6a79af35b..f2b37b208 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -411,11 +411,7 @@ impl Ty {
411 pub fn subst(self, substs: &Substs) -> Ty { 411 pub fn subst(self, substs: &Substs) -> Ty {
412 self.fold(&mut |ty| match ty { 412 self.fold(&mut |ty| match ty {
413 Ty::Param { idx, name } => { 413 Ty::Param { idx, name } => {
414 if (idx as usize) < substs.len() { 414 substs.get(idx as usize).cloned().unwrap_or(Ty::Param { idx, name })
415 substs[idx as usize].clone()
416 } else {
417 Ty::Param { idx, name }
418 }
419 } 415 }
420 ty => ty, 416 ty => ty,
421 }) 417 })
@@ -424,13 +420,7 @@ impl Ty {
424 /// Substitutes `Ty::Bound` vars (as opposed to type parameters). 420 /// Substitutes `Ty::Bound` vars (as opposed to type parameters).
425 pub fn subst_bound_vars(self, substs: &Substs) -> Ty { 421 pub fn subst_bound_vars(self, substs: &Substs) -> Ty {
426 self.fold(&mut |ty| match ty { 422 self.fold(&mut |ty| match ty {
427 Ty::Bound(idx) => { 423 Ty::Bound(idx) => substs.get(idx as usize).cloned().unwrap_or(Ty::Bound(idx)),
428 if (idx as usize) < substs.len() {
429 substs[idx as usize].clone()
430 } else {
431 Ty::Bound(idx)
432 }
433 }
434 ty => ty, 424 ty => ty,
435 }) 425 })
436 } 426 }