Lazify some mac_placeholder()
calls.
This avoids some unnecessary creation of empty token streams.
This commit is contained in:
parent
1ce0347fd4
commit
18b48bf4b9
@ -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,
|
||||
@ -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,
|
||||
}
|
||||
@ -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,
|
||||
}
|
||||
@ -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,
|
||||
}
|
||||
]),
|
||||
@ -136,7 +136,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
|
||||
id,
|
||||
ident: None,
|
||||
span,
|
||||
ty,
|
||||
ty: ty(),
|
||||
vis,
|
||||
is_placeholder: true,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user