Use option combinators instead of manual if/return
This commit is contained in:
parent
8505904dcc
commit
84c8d4f52d
1 changed files with 3 additions and 10 deletions
|
@ -2262,18 +2262,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(lit_input) = lit_input {
|
lit_input
|
||||||
// If an error occurred, ignore that it's a literal and leave reporting the error up to
|
|
||||||
// mir.
|
|
||||||
|
|
||||||
// Allow the `ty` to be an alias type, though we cannot handle it here, we just go through
|
// Allow the `ty` to be an alias type, though we cannot handle it here, we just go through
|
||||||
// the more expensive anon const code path.
|
// the more expensive anon const code path.
|
||||||
if !lit_input.ty.has_aliases() {
|
.filter(|l| !l.ty.has_aliases())
|
||||||
return Some(tcx.at(expr.span).lit_to_const(lit_input));
|
.map(|l| tcx.at(expr.span).lit_to_const(l))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lower_delegation_ty(&self, idx: hir::InferDelegationKind) -> Ty<'tcx> {
|
fn lower_delegation_ty(&self, idx: hir::InferDelegationKind) -> Ty<'tcx> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue