Rollup merge of #77884 - LingMan:ast_pretty_unwrap_or, r=varkor
Use Option::unwrap_or instead of open-coding it
This commit is contained in:
commit
31135e02fa
1 changed files with 3 additions and 6 deletions
|
@ -491,12 +491,9 @@ impl Printer {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_top(&mut self) -> PrintStackElem {
|
fn get_top(&mut self) -> PrintStackElem {
|
||||||
match self.print_stack.last() {
|
*self.print_stack.last().unwrap_or({
|
||||||
Some(el) => *el,
|
&PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) }
|
||||||
None => {
|
})
|
||||||
PrintStackElem { offset: 0, pbreak: PrintStackBreak::Broken(Breaks::Inconsistent) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_begin(&mut self, b: BeginToken, l: isize) {
|
fn print_begin(&mut self, b: BeginToken, l: isize) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue