Rollup merge of #150697 - hkBst:relate-3, r=Kivooeo

relate.rs: tiny cleanup: eliminate temp vars 2

Continuation of rust-lang/rust#150678

r? `@Kivooeo`
This commit is contained in:
Jakub Beránek
2026-01-05 15:54:14 +01:00
committed by GitHub
+3 -15
View File
@@ -216,11 +216,7 @@ fn relate<R: TypeRelation<I>>(
b: ty::AliasTy<I>,
) -> RelateResult<I, ty::AliasTy<I>> {
if a.def_id != b.def_id {
Err(TypeError::ProjectionMismatched({
let a = a.def_id;
let b = b.def_id;
ExpectedFound::new(a, b)
}))
Err(TypeError::ProjectionMismatched(ExpectedFound::new(a.def_id, b.def_id)))
} else {
let cx = relation.cx();
let args = if let Some(variances) = cx.opt_alias_variances(a.kind(cx), a.def_id) {
@@ -240,11 +236,7 @@ fn relate<R: TypeRelation<I>>(
b: ty::AliasTerm<I>,
) -> RelateResult<I, ty::AliasTerm<I>> {
if a.def_id != b.def_id {
Err(TypeError::ProjectionMismatched({
let a = a.def_id;
let b = b.def_id;
ExpectedFound::new(a, b)
}))
Err(TypeError::ProjectionMismatched(ExpectedFound::new(a.def_id, b.def_id)))
} else {
let args = match a.kind(relation.cx()) {
ty::AliasTermKind::OpaqueTy => relate_args_with_variances(
@@ -275,11 +267,7 @@ fn relate<R: TypeRelation<I>>(
b: ty::ExistentialProjection<I>,
) -> RelateResult<I, ty::ExistentialProjection<I>> {
if a.def_id != b.def_id {
Err(TypeError::ProjectionMismatched({
let a = a.def_id;
let b = b.def_id;
ExpectedFound::new(a, b)
}))
Err(TypeError::ProjectionMismatched(ExpectedFound::new(a.def_id, b.def_id)))
} else {
let term = relation.relate_with_variance(
ty::Invariant,