Simplify two matches.
Matches involving `GenericArgKind` pairs typically use a single `_` for the impossible case. This commit shortens two verbose matches in this way.
This commit is contained in:
parent
3386530c91
commit
e800967478
@ -381,21 +381,7 @@ fn to_trace(cause: &ObligationCause<'tcx>, a: Self, b: Self) -> TypeTrace<'tcx>
|
||||
(GenericArgKind::Const(a), GenericArgKind::Const(b)) => {
|
||||
ValuePairs::Terms(ExpectedFound::new(true, a.into(), b.into()))
|
||||
}
|
||||
|
||||
(
|
||||
GenericArgKind::Lifetime(_),
|
||||
GenericArgKind::Type(_) | GenericArgKind::Const(_),
|
||||
)
|
||||
| (
|
||||
GenericArgKind::Type(_),
|
||||
GenericArgKind::Lifetime(_) | GenericArgKind::Const(_),
|
||||
)
|
||||
| (
|
||||
GenericArgKind::Const(_),
|
||||
GenericArgKind::Lifetime(_) | GenericArgKind::Type(_),
|
||||
) => {
|
||||
bug!("relating different kinds: {a:?} {b:?}")
|
||||
}
|
||||
_ => bug!("relating different kinds: {a:?} {b:?}"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -212,15 +212,7 @@ fn relate<R: TypeRelation<TyCtxt<'tcx>>>(
|
||||
(ty::GenericArgKind::Const(a_ct), ty::GenericArgKind::Const(b_ct)) => {
|
||||
Ok(relation.relate(a_ct, b_ct)?.into())
|
||||
}
|
||||
(ty::GenericArgKind::Lifetime(unpacked), x) => {
|
||||
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x)
|
||||
}
|
||||
(ty::GenericArgKind::Type(unpacked), x) => {
|
||||
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x)
|
||||
}
|
||||
(ty::GenericArgKind::Const(unpacked), x) => {
|
||||
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x)
|
||||
}
|
||||
_ => bug!("impossible case reached: can't relate: {a:?} with {b:?}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user