Skip to content

Instantly share code, notes, and snippets.

@huonw
Forked from kemurphy/oops.rs
Last active December 20, 2015 06:39
Show Gist options
  • Save huonw/6087269 to your computer and use it in GitHub Desktop.
Save huonw/6087269 to your computer and use it in GitHub Desktop.
let mut f = None;
match *e {
expr_call(f, ref args, _) => match f.node {
expr_path(path) => match dm.find(&f.id) {
Some(&v) => match v {
ast::def_variant(*) |ast::def_struct(*) => {
f = Some(expr_struct(
fld.fold_path(&path),
args.map(|x| fold_unnamed_field(*x)),
None
))
},
_ => {}
},
_ => {}
},
_ => {}
},
_ => {}
}
match f {
None => (fold::noop_fold_expr(e, fld), s),
Some(f) => (f,s)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment