Skip to content

Commit

Permalink
fix issue with error return and closure
Browse files Browse the repository at this point in the history
  • Loading branch information
vadixidav committed Nov 10, 2019
1 parent 44d062e commit 7cc85ca
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions deep-backend-tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@ where
Entry::Occupied(o) => return Ok(o.get()[internal.output].clone()),
Entry::Vacant(_) => graph.ops[internal.node].clone(),
};
let ty = op.into();
ImOp::solve(op, self, backend, graph, state, inputs).map(|imop| {
let solutions = backend
let ty = (&op).into();
ImOp::solve(op, self, backend, graph, state, inputs).and_then(|imop| {
backend
.solve(imop, &state[internal.node][..])
.ok_or_else(|| Error::OpHasNoHandler { ty })?;
let output = solutions[internal.output].clone();
self.solved.insert(internal, solutions);
output
.map(|solutions| {
let output = solutions[internal.output].clone();
self.solved.insert(internal, solutions);
output
})
.ok_or_else(|| Error::OpHasNoHandler { ty })
})
}
}
Expand Down

0 comments on commit 7cc85ca

Please sign in to comment.