HIR: remove the NodeId find
This commit is contained in:
parent
d08bd72e97
commit
90de9edce5
4 changed files with 11 additions and 13 deletions
|
|
@ -410,7 +410,10 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
|||
let mut decl_id = None;
|
||||
let mut docs = String::new();
|
||||
let mut attrs = vec![];
|
||||
if let Some(Node::ImplItem(item)) = self.tcx.hir().find(id) {
|
||||
let hir_id = self.tcx.hir().node_to_hir_id(id);
|
||||
if let Some(Node::ImplItem(item)) =
|
||||
self.tcx.hir().find_by_hir_id(hir_id)
|
||||
{
|
||||
docs = self.docs_for_attrs(&item.attrs);
|
||||
attrs = item.attrs.to_vec();
|
||||
}
|
||||
|
|
@ -451,8 +454,9 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
|||
Some(def_id) => {
|
||||
let mut docs = String::new();
|
||||
let mut attrs = vec![];
|
||||
let hir_id = self.tcx.hir().node_to_hir_id(id);
|
||||
|
||||
if let Some(Node::TraitItem(item)) = self.tcx.hir().find(id) {
|
||||
if let Some(Node::TraitItem(item)) = self.tcx.hir().find_by_hir_id(hir_id) {
|
||||
docs = self.docs_for_attrs(&item.attrs);
|
||||
attrs = item.attrs.to_vec();
|
||||
}
|
||||
|
|
@ -521,7 +525,8 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
|||
}
|
||||
match expr.node {
|
||||
ast::ExprKind::Field(ref sub_ex, ident) => {
|
||||
let hir_node = match self.tcx.hir().find(sub_ex.id) {
|
||||
let sub_ex_hir_id = self.tcx.hir().node_to_hir_id(sub_ex.id);
|
||||
let hir_node = match self.tcx.hir().find_by_hir_id(sub_ex_hir_id) {
|
||||
Some(Node::Expr(expr)) => expr,
|
||||
_ => {
|
||||
debug!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue