Skip to content

Commit 8d5ee1a

Browse files
committed
make impl_subject more readable
1 parent e2f5a5a commit 8d5ee1a

File tree

1 file changed

+4
-6
lines changed
  • compiler/rustc_middle/src/hir

1 file changed

+4
-6
lines changed

compiler/rustc_middle/src/hir/mod.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,10 @@ impl<'tcx> TyCtxt<'tcx> {
105105
}
106106

107107
pub fn impl_subject(self, def_id: DefId) -> EarlyBinder<ImplSubject<'tcx>> {
108-
EarlyBinder(
109-
self.impl_trait_ref(def_id)
110-
.map(|t| t.subst_identity())
111-
.map(ImplSubject::Trait)
112-
.unwrap_or_else(|| ImplSubject::Inherent(self.type_of(def_id).subst_identity())),
113-
)
108+
match self.impl_trait_ref(def_id) {
109+
Some(t) => t.map_bound(ImplSubject::Trait),
110+
None => self.type_of(def_id).map_bound(ImplSubject::Inherent),
111+
}
114112
}
115113
}
116114

0 commit comments

Comments
 (0)