Inline and remove three DummyResult
methods.
They each have a single call site.
This commit is contained in:
parent
e809df6ed4
commit
d7f5319b6d
1 changed files with 22 additions and 32 deletions
|
@ -571,35 +571,6 @@ impl DummyResult {
|
|||
tokens: None,
|
||||
})
|
||||
}
|
||||
|
||||
/// A plain dummy pattern.
|
||||
pub fn raw_pat(sp: Span) -> ast::Pat {
|
||||
ast::Pat { id: ast::DUMMY_NODE_ID, kind: PatKind::Wild, span: sp, tokens: None }
|
||||
}
|
||||
|
||||
/// A plain dummy type.
|
||||
pub fn raw_ty(sp: Span) -> P<ast::Ty> {
|
||||
// FIXME(nnethercote): you might expect `ast::TyKind::Dummy` to be used here, but some
|
||||
// values produced here end up being lowered to HIR, which `ast::TyKind::Dummy` does not
|
||||
// support, so we use an empty tuple instead.
|
||||
P(ast::Ty {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
kind: ast::TyKind::Tup(ThinVec::new()),
|
||||
span: sp,
|
||||
tokens: None,
|
||||
})
|
||||
}
|
||||
|
||||
/// A plain dummy crate.
|
||||
pub fn raw_crate() -> ast::Crate {
|
||||
ast::Crate {
|
||||
attrs: Default::default(),
|
||||
items: Default::default(),
|
||||
spans: Default::default(),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
is_placeholder: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MacResult for DummyResult {
|
||||
|
@ -608,7 +579,12 @@ impl MacResult for DummyResult {
|
|||
}
|
||||
|
||||
fn make_pat(self: Box<DummyResult>) -> Option<P<ast::Pat>> {
|
||||
Some(P(DummyResult::raw_pat(self.span)))
|
||||
Some(P(ast::Pat {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
kind: PatKind::Wild,
|
||||
span: self.span,
|
||||
tokens: None,
|
||||
}))
|
||||
}
|
||||
|
||||
fn make_items(self: Box<DummyResult>) -> Option<SmallVec<[P<ast::Item>; 1]>> {
|
||||
|
@ -636,7 +612,15 @@ impl MacResult for DummyResult {
|
|||
}
|
||||
|
||||
fn make_ty(self: Box<DummyResult>) -> Option<P<ast::Ty>> {
|
||||
Some(DummyResult::raw_ty(self.span))
|
||||
// FIXME(nnethercote): you might expect `ast::TyKind::Dummy` to be used here, but some
|
||||
// values produced here end up being lowered to HIR, which `ast::TyKind::Dummy` does not
|
||||
// support, so we use an empty tuple instead.
|
||||
Some(P(ast::Ty {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
kind: ast::TyKind::Tup(ThinVec::new()),
|
||||
span: self.span,
|
||||
tokens: None,
|
||||
}))
|
||||
}
|
||||
|
||||
fn make_arms(self: Box<DummyResult>) -> Option<SmallVec<[ast::Arm; 1]>> {
|
||||
|
@ -668,7 +652,13 @@ impl MacResult for DummyResult {
|
|||
}
|
||||
|
||||
fn make_crate(self: Box<DummyResult>) -> Option<ast::Crate> {
|
||||
Some(DummyResult::raw_crate())
|
||||
Some(ast::Crate {
|
||||
attrs: Default::default(),
|
||||
items: Default::default(),
|
||||
spans: Default::default(),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
is_placeholder: Default::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue