提交 cdd1c0ef 编写于 作者: J John Kåre Alsaker

Don't use an allocation for ItemId in StmtKind

上级 eac09088
......@@ -951,7 +951,7 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) {
visitor.visit_id(statement.id);
match statement.node {
StmtKind::Local(ref local) => visitor.visit_local(local),
StmtKind::Item(ref item) => visitor.visit_nested_item(**item),
StmtKind::Item(item) => visitor.visit_nested_item(item),
StmtKind::Expr(ref expression) |
StmtKind::Semi(ref expression) => {
visitor.visit_expr(expression)
......
......@@ -4663,7 +4663,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
hir::Stmt {
id: node_id,
hir_id,
node: hir::StmtKind::Item(P(item_id)),
node: hir::StmtKind::Item(item_id),
span: s.span,
}
})
......@@ -4693,7 +4693,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
hir::Stmt {
id: node_id,
hir_id,
node: hir::StmtKind::Item(P(item_id)),
node: hir::StmtKind::Item(item_id),
span: s.span,
}
})
......
......@@ -1159,8 +1159,9 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
pub enum StmtKind {
/// A local (`let`) binding.
Local(P<Local>),
/// An item binding.
Item(P<ItemId>),
Item(ItemId),
/// An expression without a trailing semi-colon (must have unit type).
Expr(P<Expr>),
......
......@@ -1007,8 +1007,8 @@ pub fn print_stmt(&mut self, st: &hir::Stmt) -> io::Result<()> {
}
self.end()?
}
hir::StmtKind::Item(ref item) => {
self.ann.nested(self, Nested::Item(**item))?
hir::StmtKind::Item(item) => {
self.ann.nested(self, Nested::Item(item))?
}
hir::StmtKind::Expr(ref expr) => {
self.space_if_not_bol()?;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册