Skip to content

Commit c92ed62

Browse files
committed
Use option combinators instead of manual if/return
1 parent 9c879a0 commit c92ed62

File tree

1 file changed

+3
-10
lines changed
  • compiler/rustc_hir_analysis/src/hir_ty_lowering

1 file changed

+3
-10
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -2262,18 +2262,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
22622262
_ => None,
22632263
};
22642264

2265-
if let Some(lit_input) = lit_input {
2266-
// If an error occurred, ignore that it's a literal and leave reporting the error up to
2267-
// mir.
2268-
2265+
lit_input
22692266
// Allow the `ty` to be an alias type, though we cannot handle it here, we just go through
22702267
// the more expensive anon const code path.
2271-
if !lit_input.ty.has_aliases() {
2272-
return Some(tcx.at(expr.span).lit_to_const(lit_input));
2273-
}
2274-
}
2275-
2276-
None
2268+
.filter(|l| !l.ty.has_aliases())
2269+
.map(|l| tcx.at(expr.span).lit_to_const(l))
22772270
}
22782271

22792272
fn lower_delegation_ty(&self, idx: hir::InferDelegationKind) -> Ty<'tcx> {

0 commit comments

Comments
 (0)