Skip to content

Commit ca7e5c1

Browse files
committed
exit: Use OwnerNode.
1 parent 5368895 commit ca7e5c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clippy_lints/src/exit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::span_lint;
22
use clippy_utils::is_entrypoint_fn;
3-
use rustc_hir::{Expr, ExprKind, Item, ItemKind, Node};
3+
use rustc_hir::{Expr, ExprKind, Item, ItemKind, OwnerNode};
44
use rustc_lint::{LateContext, LateLintPass};
55
use rustc_session::declare_lint_pass;
66
use rustc_span::sym;
@@ -47,8 +47,8 @@ impl<'tcx> LateLintPass<'tcx> for Exit {
4747
&& let ExprKind::Path(ref path) = path_expr.kind
4848
&& let Some(def_id) = cx.qpath_res(path, path_expr.hir_id).opt_def_id()
4949
&& cx.tcx.is_diagnostic_item(sym::process_exit, def_id)
50-
&& let parent = cx.tcx.hir().get_parent_item(e.hir_id).def_id
51-
&& let Node::Item(Item{kind: ItemKind::Fn(..), ..}) = cx.tcx.hir_node_by_def_id(parent)
50+
&& let parent = cx.tcx.hir().get_parent_item(e.hir_id)
51+
&& let OwnerNode::Item(Item{kind: ItemKind::Fn(..), ..}) = cx.tcx.hir_owner_node(parent)
5252
// If the next item up is a function we check if it is an entry point
5353
// and only then emit a linter warning
5454
&& !is_entrypoint_fn(cx, parent.to_def_id())

0 commit comments

Comments
 (0)