Skip to content

Commit

Permalink
Lazify some mac_placeholder() calls.
Browse files Browse the repository at this point in the history
This avoids some unnecessary creation of empty token streams.
  • Loading branch information
nnethercote committed Oct 13, 2019
1 parent 1ce0347 commit 18b48bf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/libsyntax/ext/placeholders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
attrs: ThinVec::new(),
kind: ast::ExprKind::Mac(mac_placeholder()),
});
let ty = P(ast::Ty {
let ty = || P(ast::Ty {
id,
kind: ast::TyKind::Mac(mac_placeholder()),
span,
});
let pat = P(ast::Pat {
let pat = || P(ast::Pat {
id,
kind: ast::PatKind::Mac(mac_placeholder()),
span,
Expand Down Expand Up @@ -83,7 +83,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
body: expr_placeholder(),
guard: None,
id,
pat,
pat: pat(),
span,
is_placeholder: true,
}
Expand All @@ -105,7 +105,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
id,
ident,
is_shorthand: false,
pat,
pat: pat(),
span,
is_placeholder: true,
}
Expand All @@ -124,9 +124,9 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
ast::Param {
attrs: Default::default(),
id,
pat,
pat: pat(),
span,
ty,
ty: ty(),
is_placeholder: true,
}
]),
Expand All @@ -136,7 +136,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
id,
ident: None,
span,
ty,
ty: ty(),
vis,
is_placeholder: true,
}
Expand Down

0 comments on commit 18b48bf

Please sign in to comment.