Skip to content

Commit d7f5319

Browse files
committed
Inline and remove three DummyResult methods.
They each have a single call site.
1 parent e809df6 commit d7f5319

File tree

1 file changed

+22
-32
lines changed

1 file changed

+22
-32
lines changed

compiler/rustc_expand/src/base.rs

+22-32
Original file line numberDiff line numberDiff line change
@@ -571,35 +571,6 @@ impl DummyResult {
571571
tokens: None,
572572
})
573573
}
574-
575-
/// A plain dummy pattern.
576-
pub fn raw_pat(sp: Span) -> ast::Pat {
577-
ast::Pat { id: ast::DUMMY_NODE_ID, kind: PatKind::Wild, span: sp, tokens: None }
578-
}
579-
580-
/// A plain dummy type.
581-
pub fn raw_ty(sp: Span) -> P<ast::Ty> {
582-
// FIXME(nnethercote): you might expect `ast::TyKind::Dummy` to be used here, but some
583-
// values produced here end up being lowered to HIR, which `ast::TyKind::Dummy` does not
584-
// support, so we use an empty tuple instead.
585-
P(ast::Ty {
586-
id: ast::DUMMY_NODE_ID,
587-
kind: ast::TyKind::Tup(ThinVec::new()),
588-
span: sp,
589-
tokens: None,
590-
})
591-
}
592-
593-
/// A plain dummy crate.
594-
pub fn raw_crate() -> ast::Crate {
595-
ast::Crate {
596-
attrs: Default::default(),
597-
items: Default::default(),
598-
spans: Default::default(),
599-
id: ast::DUMMY_NODE_ID,
600-
is_placeholder: Default::default(),
601-
}
602-
}
603574
}
604575

605576
impl MacResult for DummyResult {
@@ -608,7 +579,12 @@ impl MacResult for DummyResult {
608579
}
609580

610581
fn make_pat(self: Box<DummyResult>) -> Option<P<ast::Pat>> {
611-
Some(P(DummyResult::raw_pat(self.span)))
582+
Some(P(ast::Pat {
583+
id: ast::DUMMY_NODE_ID,
584+
kind: PatKind::Wild,
585+
span: self.span,
586+
tokens: None,
587+
}))
612588
}
613589

614590
fn make_items(self: Box<DummyResult>) -> Option<SmallVec<[P<ast::Item>; 1]>> {
@@ -636,7 +612,15 @@ impl MacResult for DummyResult {
636612
}
637613

638614
fn make_ty(self: Box<DummyResult>) -> Option<P<ast::Ty>> {
639-
Some(DummyResult::raw_ty(self.span))
615+
// FIXME(nnethercote): you might expect `ast::TyKind::Dummy` to be used here, but some
616+
// values produced here end up being lowered to HIR, which `ast::TyKind::Dummy` does not
617+
// support, so we use an empty tuple instead.
618+
Some(P(ast::Ty {
619+
id: ast::DUMMY_NODE_ID,
620+
kind: ast::TyKind::Tup(ThinVec::new()),
621+
span: self.span,
622+
tokens: None,
623+
}))
640624
}
641625

642626
fn make_arms(self: Box<DummyResult>) -> Option<SmallVec<[ast::Arm; 1]>> {
@@ -668,7 +652,13 @@ impl MacResult for DummyResult {
668652
}
669653

670654
fn make_crate(self: Box<DummyResult>) -> Option<ast::Crate> {
671-
Some(DummyResult::raw_crate())
655+
Some(ast::Crate {
656+
attrs: Default::default(),
657+
items: Default::default(),
658+
spans: Default::default(),
659+
id: ast::DUMMY_NODE_ID,
660+
is_placeholder: Default::default(),
661+
})
672662
}
673663
}
674664

0 commit comments

Comments
 (0)