- let mut delegate = MutateDelegate { cx: cx, node_id_low: bound_ids[0], node_id_high: bound_ids[1], span_low: None, span_high: None };
- if let Some(id) = get_id_if_some(&bound_ids) {
- let def_id = cx.tcx.hir.local_def_id(id);
- let region_scope_tree = &cx.tcx.region_scope_tree(def_id);
- ExprUseVisitor::new(&mut delegate, cx.tcx, cx.param_env, region_scope_tree, cx.tables).walk_expr(body);
- return delegate.mutation_span();
- } else {
- return (None, None);
- }
-}
-
-fn get_id_if_some(bound_ids: &Vec<Option<NodeId>>) -> Option<NodeId> {
- for id in bound_ids.into_iter() {
- if id.is_some() {
- return *id;
- }
- }
- return None;
+ let mut delegate = MutateDelegate { node_id_low: bound_ids[0], node_id_high: bound_ids[1], span_low: None, span_high: None };
+ let def_id = def_id::DefId::local(body.hir_id.owner);
+ let region_scope_tree = &cx.tcx.region_scope_tree(def_id);
+ ExprUseVisitor::new(&mut delegate, cx.tcx, cx.param_env, region_scope_tree, cx.tables).walk_expr(body);
+ return delegate.mutation_span();