Rollup merge of #68441 - Centril:pprust-as_deref, r=Mark-Simulacrum

pprust: use as_deref

Some drive-by cleanup.
This commit is contained in:
Tyler Mandry 2020-01-22 16:02:20 -08:00 committed by GitHub
commit 14e6259c29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1645,7 +1645,7 @@ impl<'a> State<'a> {
self.print_expr_as_cond(i);
self.s.space();
self.print_block(then);
self.print_else(e.as_ref().map(|e| &**e))
self.print_else(e.as_deref())
}
// Final `else` block.
ast::ExprKind::Block(ref b, _) => {
@ -1949,7 +1949,7 @@ impl<'a> State<'a> {
self.print_let(pat, scrutinee);
}
ast::ExprKind::If(ref test, ref blk, ref elseopt) => {
self.print_if(test, blk, elseopt.as_ref().map(|e| &**e));
self.print_if(test, blk, elseopt.as_deref())
}
ast::ExprKind::While(ref test, ref blk, opt_label) => {
if let Some(label) = opt_label {