Fix fallout cause NodeId pruning

This commit is contained in:
Lzu Tao
2019-06-22 13:41:16 +07:00
parent 9cae8aa9a9
commit 6aea41e050
5 changed files with 6 additions and 6 deletions

View File

@@ -66,7 +66,7 @@ pub fn differing_macro_contexts(lhs: Span, rhs: Span) -> bool {
/// ```
pub fn in_constant(cx: &LateContext<'_, '_>, id: HirId) -> bool {
let parent_id = cx.tcx.hir().get_parent_item(id);
match cx.tcx.hir().get_by_hir_id(parent_id) {
match cx.tcx.hir().get(parent_id) {
Node::Item(&Item {
node: ItemKind::Const(..),
..
@@ -320,7 +320,7 @@ pub fn trait_ref_of_method<'tcx>(cx: &LateContext<'_, 'tcx>, hir_id: HirId) -> O
let parent_impl = cx.tcx.hir().get_parent_item(hir_id);
if_chain! {
if parent_impl != hir::CRATE_HIR_ID;
if let hir::Node::Item(item) = cx.tcx.hir().get_by_hir_id(parent_impl);
if let hir::Node::Item(item) = cx.tcx.hir().get(parent_impl);
if let hir::ItemKind::Impl(_, _, _, _, trait_ref, _, _) = &item.node;
then { return trait_ref.as_ref(); }
}