Skip to content

Commit 469a264

Browse files
authored
Rollup merge of #150697 - hkBst:relate-3, r=Kivooeo
relate.rs: tiny cleanup: eliminate temp vars 2 Continuation of #150678 r? `@Kivooeo`
2 parents 5bcdc7c + 3d6a2c5 commit 469a264

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

compiler/rustc_type_ir/src/relate.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,7 @@ impl<I: Interner> Relate<I> for ty::AliasTy<I> {
216216
b: ty::AliasTy<I>,
217217
) -> RelateResult<I, ty::AliasTy<I>> {
218218
if a.def_id != b.def_id {
219-
Err(TypeError::ProjectionMismatched({
220-
let a = a.def_id;
221-
let b = b.def_id;
222-
ExpectedFound::new(a, b)
223-
}))
219+
Err(TypeError::ProjectionMismatched(ExpectedFound::new(a.def_id, b.def_id)))
224220
} else {
225221
let cx = relation.cx();
226222
let args = if let Some(variances) = cx.opt_alias_variances(a.kind(cx), a.def_id) {
@@ -240,11 +236,7 @@ impl<I: Interner> Relate<I> for ty::AliasTerm<I> {
240236
b: ty::AliasTerm<I>,
241237
) -> RelateResult<I, ty::AliasTerm<I>> {
242238
if a.def_id != b.def_id {
243-
Err(TypeError::ProjectionMismatched({
244-
let a = a.def_id;
245-
let b = b.def_id;
246-
ExpectedFound::new(a, b)
247-
}))
239+
Err(TypeError::ProjectionMismatched(ExpectedFound::new(a.def_id, b.def_id)))
248240
} else {
249241
let args = match a.kind(relation.cx()) {
250242
ty::AliasTermKind::OpaqueTy => relate_args_with_variances(
@@ -275,11 +267,7 @@ impl<I: Interner> Relate<I> for ty::ExistentialProjection<I> {
275267
b: ty::ExistentialProjection<I>,
276268
) -> RelateResult<I, ty::ExistentialProjection<I>> {
277269
if a.def_id != b.def_id {
278-
Err(TypeError::ProjectionMismatched({
279-
let a = a.def_id;
280-
let b = b.def_id;
281-
ExpectedFound::new(a, b)
282-
}))
270+
Err(TypeError::ProjectionMismatched(ExpectedFound::new(a.def_id, b.def_id)))
283271
} else {
284272
let term = relation.relate_with_variance(
285273
ty::Invariant,

0 commit comments

Comments
 (0)