Skip to content

Commit e800967

Browse files
committed
Simplify two matches.
Matches involving `GenericArgKind` pairs typically use a single `_` for the impossible case. This commit shortens two verbose matches in this way.
1 parent 3386530 commit e800967

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

compiler/rustc_infer/src/infer/at.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -381,21 +381,7 @@ impl<'tcx> ToTrace<'tcx> for ty::GenericArg<'tcx> {
381381
(GenericArgKind::Const(a), GenericArgKind::Const(b)) => {
382382
ValuePairs::Terms(ExpectedFound::new(true, a.into(), b.into()))
383383
}
384-
385-
(
386-
GenericArgKind::Lifetime(_),
387-
GenericArgKind::Type(_) | GenericArgKind::Const(_),
388-
)
389-
| (
390-
GenericArgKind::Type(_),
391-
GenericArgKind::Lifetime(_) | GenericArgKind::Const(_),
392-
)
393-
| (
394-
GenericArgKind::Const(_),
395-
GenericArgKind::Lifetime(_) | GenericArgKind::Type(_),
396-
) => {
397-
bug!("relating different kinds: {a:?} {b:?}")
398-
}
384+
_ => bug!("relating different kinds: {a:?} {b:?}"),
399385
},
400386
}
401387
}

compiler/rustc_middle/src/ty/relate.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,7 @@ impl<'tcx> Relate<TyCtxt<'tcx>> for ty::GenericArg<'tcx> {
212212
(ty::GenericArgKind::Const(a_ct), ty::GenericArgKind::Const(b_ct)) => {
213213
Ok(relation.relate(a_ct, b_ct)?.into())
214214
}
215-
(ty::GenericArgKind::Lifetime(unpacked), x) => {
216-
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x)
217-
}
218-
(ty::GenericArgKind::Type(unpacked), x) => {
219-
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x)
220-
}
221-
(ty::GenericArgKind::Const(unpacked), x) => {
222-
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x)
223-
}
215+
_ => bug!("impossible case reached: can't relate: {a:?} with {b:?}"),
224216
}
225217
}
226218
}

0 commit comments

Comments
 (0)