mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
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:
@@ -491,12 +491,9 @@ fn indent(&mut self, amount: isize) {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user