Skip to content

Commit cdd1c0e

Browse files
committed
Don't use an allocation for ItemId in StmtKind
1 parent eac0908 commit cdd1c0e

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) {
951951
visitor.visit_id(statement.id);
952952
match statement.node {
953953
StmtKind::Local(ref local) => visitor.visit_local(local),
954-
StmtKind::Item(ref item) => visitor.visit_nested_item(**item),
954+
StmtKind::Item(item) => visitor.visit_nested_item(item),
955955
StmtKind::Expr(ref expression) |
956956
StmtKind::Semi(ref expression) => {
957957
visitor.visit_expr(expression)

src/librustc/hir/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4663,7 +4663,7 @@ impl<'a> LoweringContext<'a> {
46634663
hir::Stmt {
46644664
id: node_id,
46654665
hir_id,
4666-
node: hir::StmtKind::Item(P(item_id)),
4666+
node: hir::StmtKind::Item(item_id),
46674667
span: s.span,
46684668
}
46694669
})
@@ -4693,7 +4693,7 @@ impl<'a> LoweringContext<'a> {
46934693
hir::Stmt {
46944694
id: node_id,
46954695
hir_id,
4696-
node: hir::StmtKind::Item(P(item_id)),
4696+
node: hir::StmtKind::Item(item_id),
46974697
span: s.span,
46984698
}
46994699
})

src/librustc/hir/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,9 @@ impl fmt::Debug for Stmt {
11591159
pub enum StmtKind {
11601160
/// A local (`let`) binding.
11611161
Local(P<Local>),
1162+
11621163
/// An item binding.
1163-
Item(P<ItemId>),
1164+
Item(ItemId),
11641165

11651166
/// An expression without a trailing semi-colon (must have unit type).
11661167
Expr(P<Expr>),

src/librustc/hir/print.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,8 +1007,8 @@ impl<'a> State<'a> {
10071007
}
10081008
self.end()?
10091009
}
1010-
hir::StmtKind::Item(ref item) => {
1011-
self.ann.nested(self, Nested::Item(**item))?
1010+
hir::StmtKind::Item(item) => {
1011+
self.ann.nested(self, Nested::Item(item))?
10121012
}
10131013
hir::StmtKind::Expr(ref expr) => {
10141014
self.space_if_not_bol()?;

0 commit comments

Comments
 (0)