about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLingMan <LingMan@users.noreply.github.com>2020-10-13 01:05:35 +0200
committerLingMan <LingMan@users.noreply.github.com>2020-10-13 04:30:17 +0200
commit61e722f3312d9669e2789ff76543adacf75e5e08 (patch)
treea37364df4fa5d2e299679430ca2d2a98a7183758
parentf3ab6f05846951bed41d4b0661ac0735aebf3687 (diff)
downloadrust-61e722f3312d9669e2789ff76543adacf75e5e08.tar.gz
rust-61e722f3312d9669e2789ff76543adacf75e5e08.zip
Use Option::unwrap_or instead of open-coding it
-rw-r--r--compiler/rustc_ast_pretty/src/pp.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs
index ca7f127ced6..ba9081bb8a6 100644
--- a/compiler/rustc_ast_pretty/src/pp.rs
+++ b/compiler/rustc_ast_pretty/src/pp.rs
@@ -491,12 +491,9 @@ impl Printer {
     }
 
     fn get_top(&mut self) -> PrintStackElem {
-        match self.print_stack.last() {
-            Some(el) => *el,
-            None => {
-                PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) }
-            }
-        }
+        *self.print_stack.last().unwrap_or({
+            &PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) }
+        })
     }
 
     fn print_begin(&mut self, b: BeginToken, l: isize) {