There. Now the generic line function doesn't handle details like range or walls.
He can accept an arbitrary amount of conditions by creating a nested tuple Predicate: (pred, (pred, (pred, pred))). Maybe I'd implement more tuple-to-predicate conversions if I was using that, but we don't have variadics in Rust, so nested tuples might be the lesser of two evils.
The point is that he could even be used with more predicates in the future (like wall strength) without adding any more code, and I've done this while shrinking the function body.
There. Now the generic line function doesn't handle details like range or walls.
He can accept an arbitrary amount of conditions by creating a nested tuple Predicate:
(pred, (pred, (pred, pred)))
. Maybe I'd implement more tuple-to-predicate conversions if I was using that, but we don't have variadics in Rust, so nested tuples might be the lesser of two evils.The point is that he could even be used with more predicates in the future (like wall strength) without adding any more code, and I've done this while shrinking the function body.
That's a refactor success imo.