diff options
| author | LingMan <LingMan@users.noreply.github.com> | 2020-10-13 01:05:35 +0200 |
|---|---|---|
| committer | LingMan <LingMan@users.noreply.github.com> | 2020-10-13 04:30:17 +0200 |
| commit | 61e722f3312d9669e2789ff76543adacf75e5e08 (patch) | |
| tree | a37364df4fa5d2e299679430ca2d2a98a7183758 | |
| parent | f3ab6f05846951bed41d4b0661ac0735aebf3687 (diff) | |
| download | rust-61e722f3312d9669e2789ff76543adacf75e5e08.tar.gz rust-61e722f3312d9669e2789ff76543adacf75e5e08.zip | |
Use Option::unwrap_or instead of open-coding it
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pp.rs | 9 |
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) { |
