Emit simpler code from format_args
This commit is contained in:
parent
ee5d8d37ba
commit
abf1d94b1a
9 changed files with 112 additions and 92 deletions
|
@ -39,6 +39,7 @@ use rustc_span::{Span, DUMMY_SP};
|
|||
use std::cmp::Ordering;
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
@ -1276,6 +1277,19 @@ impl Expr {
|
|||
ExprKind::Err => ExprPrecedence::Err,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn take(&mut self) -> Self {
|
||||
mem::replace(
|
||||
self,
|
||||
Expr {
|
||||
id: DUMMY_NODE_ID,
|
||||
kind: ExprKind::Err,
|
||||
span: DUMMY_SP,
|
||||
attrs: ThinVec::new(),
|
||||
tokens: None,
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Limit types of a range (inclusive or exclusive)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue