Skip to content

Commit 61e722f

Browse files
committed
Use Option::unwrap_or instead of open-coding it
1 parent f3ab6f0 commit 61e722f

File tree

1 file changed

+3
-6
lines changed
  • compiler/rustc_ast_pretty/src

1 file changed

+3
-6
lines changed

compiler/rustc_ast_pretty/src/pp.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,9 @@ impl Printer {
491491
}
492492

493493
fn get_top(&mut self) -> PrintStackElem {
494-
match self.print_stack.last() {
495-
Some(el) => *el,
496-
None => {
497-
PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) }
498-
}
499-
}
494+
*self.print_stack.last().unwrap_or({
495+
&PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) }
496+
})
500497
}
501498

502499
fn print_begin(&mut self, b: BeginToken, l: isize) {

0 commit comments

Comments
 (0)