remove uses of the NodeId hir::map::expr
This commit is contained in:
parent
21e63dddbe
commit
2d1e223a0e
3 changed files with 4 additions and 8 deletions
|
|
@ -927,12 +927,6 @@ impl<'hir> Map<'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn expect_expr(&self, id: NodeId) -> &'hir Expr {
|
||||
let hir_id = self.node_to_hir_id(id);
|
||||
self.expect_expr_by_hir_id(hir_id)
|
||||
}
|
||||
|
||||
// FIXME(@ljedrz): replace the `NodeId` variant.
|
||||
pub fn expect_expr_by_hir_id(&self, id: HirId) -> &'hir Expr {
|
||||
match self.find_by_hir_id(id) { // read recorded by find
|
||||
Some(Node::Expr(expr)) => expr,
|
||||
|
|
|
|||
|
|
@ -1531,7 +1531,8 @@ impl<'l, 'tcx, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, '
|
|||
self.process_macro_use(ex.span);
|
||||
match ex.node {
|
||||
ast::ExprKind::Struct(ref path, ref fields, ref base) => {
|
||||
let hir_expr = self.save_ctxt.tcx.hir().expect_expr(ex.id);
|
||||
let expr_hir_id = self.save_ctxt.tcx.hir().node_to_hir_id(ex.id);
|
||||
let hir_expr = self.save_ctxt.tcx.hir().expect_expr_by_hir_id(expr_hir_id);
|
||||
let adt = match self.save_ctxt.tables.expr_ty_opt(&hir_expr) {
|
||||
Some(ty) if ty.ty_adt_def().is_some() => ty.ty_adt_def().unwrap(),
|
||||
_ => {
|
||||
|
|
|
|||
|
|
@ -513,7 +513,8 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
|
||||
let hir_node = self.tcx.hir().expect_expr(expr.id);
|
||||
let expr_hir_id = self.tcx.hir().node_to_hir_id(expr.id);
|
||||
let hir_node = self.tcx.hir().expect_expr_by_hir_id(expr_hir_id);
|
||||
let ty = self.tables.expr_ty_adjusted_opt(&hir_node);
|
||||
if ty.is_none() || ty.unwrap().sty == ty::Error {
|
||||
return None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue