use std::cmp;
use std::u32;
-use std::result::Result::Err;
#[derive(Copy, Clone)]
pub enum FnKind<'a> {
ExprKind::Break(ref destination, ref opt_expr) => {
if let Some(ref label) = destination.label {
visitor.visit_label(label);
- match destination.target_id {
- Ok(node_id) => visitor.visit_def_mention(Def::Label(node_id)),
- Err(_) => {},
- };
+ if let Ok(node_id) = destination.target_id {
+ visitor.visit_def_mention(Def::Label(node_id))
+ }
}
walk_list!(visitor, visit_expr, opt_expr);
}
ExprKind::Continue(ref destination) => {
if let Some(ref label) = destination.label {
visitor.visit_label(label);
- match destination.target_id {
- Ok(node_id) => visitor.visit_def_mention(Def::Label(node_id)),
- Err(_) => {},
- };
+ if let Ok(node_id) = destination.target_id {
+ visitor.visit_def_mention(Def::Label(node_id))
+ }
}
}
ExprKind::Ret(ref optional_expression) => {
walk_list!(visitor, visit_expr, optional_expression);
}
ExprKind::InlineAsm(_, ref outputs, ref inputs) => {
- for output in outputs {
- visitor.visit_expr(output)
- }
- for input in inputs {
- visitor.visit_expr(input)
+ for expr in outputs.iter().chain(inputs.iter()) {
+ visitor.visit_expr(expr)
}
}
ExprKind::Yield(ref subexpression) => {
pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm) {
walk_list!(visitor, visit_pat, &arm.pats);
- walk_list!(visitor, visit_expr, &arm.guard);
+ if let Some(ref g) = arm.guard {
+ match g {
+ Guard::If(ref e) => visitor.visit_expr(e),
+ }
+ }
visitor.visit_expr(&arm.body);
walk_list!(visitor, visit_attribute, &arm.attrs);
}
self.min = cmp::min(self.min, id);
self.max = cmp::max(self.max, NodeId::from_u32(id.as_u32() + 1));
}
-
}