fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx>
If the type is Option<T>, it will return T, otherwise the type itself. Works on most Option-like types.
Option<T>
T
Option