a small refactoring for readability

This commit is contained in:
Oliver Schneider 2016-03-24 16:02:26 +01:00
parent 6904fd5a49
commit 25bbde091a

View File

@ -87,12 +87,11 @@ fn run(&mut self, e: &'v Expr) -> Result<Bool, String> {
_ => {},
}
}
if let Some((n, _)) = self.terminals
.iter()
.enumerate()
.find(|&(_, expr)| SpanlessEq::new(self.cx).ignore_fn().eq_expr(e, expr)) {
#[allow(cast_possible_truncation)]
return Ok(Bool::Term(n as u8));
for (n, expr) in self.terminals.iter().enumerate() {
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(e, expr) {
#[allow(cast_possible_truncation)]
return Ok(Bool::Term(n as u8));
}
}
let n = self.terminals.len();
self.terminals.push(e);