diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-14 06:02:33 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-14 06:02:33 +0900 |
| commit | 31135e02fac0c7bfbba05b26f6c6b8bda1fa49ad (patch) | |
| tree | ea0880a6cbf87ea4977ec6c838a82b7398a15c46 /compiler | |
| parent | c82478719bc2cd5ef2c1bf9d493d871fa6b59384 (diff) | |
| parent | 61e722f3312d9669e2789ff76543adacf75e5e08 (diff) | |
| download | rust-31135e02fac0c7bfbba05b26f6c6b8bda1fa49ad.tar.gz rust-31135e02fac0c7bfbba05b26f6c6b8bda1fa49ad.zip | |
Rollup merge of #77884 - LingMan:ast_pretty_unwrap_or, r=varkor
Use Option::unwrap_or instead of open-coding it
Diffstat (limited to 'compiler')
| -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) { |
