Use "if let Some(_)" instead of match
@@ -484,8 +484,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
}
let mut arm_size = 0;
- match *cond {
- Some(ref expr) => {
+ if let Some(expr) = cond {
if i == 0 {
buf.write("if ");
} else {
@@ -501,13 +500,11 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
let expr_code = self.visit_expr_root(expr)?;
buf.write(&expr_code);
buf.write(") as &bool)");
- }
- None => {
+ } else {
buf.dedent()?;
buf.write("} else");
has_else = true;
}
- }
buf.writeln(" {")?;
self.locals.push();
