rapx/check/opt/
check_utils.rs1use rustc_hir::def_id::DefId;
2
3use crate::analysis::dataflow::{GraphNode, NodeOp};
4
5pub fn node_matches_call(node: &GraphNode, def_ids: &[DefId]) -> bool {
7 for op in node.ops.iter() {
8 if let NodeOp::Call(def_id) = op {
9 if def_ids.contains(def_id) {
10 return true;
11 }
12 }
13 }
14 false
15}
16
17pub fn node_matches_any_call(node: &GraphNode, pred: impl Fn(DefId) -> bool) -> bool {
19 for op in node.ops.iter() {
20 if let NodeOp::Call(def_id) = op {
21 if pred(*def_id) {
22 return true;
23 }
24 }
25 }
26 false
27}