Skip to content

Commit 10c0560

Browse files
committed
Resolve a FIXME
1 parent d4e986c commit 10c0560

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

compiler/rustc_middle/src/ty/structural_impls.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ TrivialTypeTraversalAndLiftImpls! {
246246
///////////////////////////////////////////////////////////////////////////
247247
// Lift implementations
248248

249-
// FIXME(eddyb) replace all the uses of `Option::map` with `?`.
250249
impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>> Lift<'tcx> for (A, B) {
251250
type Lifted = (A::Lifted, B::Lifted);
252251
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
@@ -264,10 +263,7 @@ impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C)
264263
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option<T> {
265264
type Lifted = Option<T::Lifted>;
266265
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
267-
match self {
268-
Some(x) => tcx.lift(x).map(Some),
269-
None => Some(None),
270-
}
266+
tcx.lift(self?).map(Some)
271267
}
272268
}
273269

@@ -284,21 +280,21 @@ impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result<T, E> {
284280
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Box<T> {
285281
type Lifted = Box<T::Lifted>;
286282
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
287-
tcx.lift(*self).map(Box::new)
283+
Some(Box::new(tcx.lift(*self)?))
288284
}
289285
}
290286

291287
impl<'tcx, T: Lift<'tcx> + Clone> Lift<'tcx> for Rc<T> {
292288
type Lifted = Rc<T::Lifted>;
293289
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
294-
tcx.lift(self.as_ref().clone()).map(Rc::new)
290+
Some(Rc::new(tcx.lift(self.as_ref().clone())?))
295291
}
296292
}
297293

298294
impl<'tcx, T: Lift<'tcx> + Clone> Lift<'tcx> for Arc<T> {
299295
type Lifted = Arc<T::Lifted>;
300296
fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
301-
tcx.lift(self.as_ref().clone()).map(Arc::new)
297+
Some(Arc::new(tcx.lift(self.as_ref().clone())?))
302298
}
303299
}
304300
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Vec<T> {

0 commit comments

Comments
 (0)