Hi @BurntSushi, thank you for this very nice library!
This PR adds an implementation of From<bool> for TestResult.
It allows using TestResult::from(true) everywhere, and true.into() when the TestResult type can be inferred from the context, which I believe improves ergonomics in some situations:
// From the README
fn prop(xs: Vec<isize>) -> TestResult {
if xs.len() != 1 {
return TestResult::discard()
}
(xs == reverse(&xs)).into() // Instead of `TestResult::from_bool(xs == reverse(&xs))`
}
Hi @BurntSushi, thank you for this very nice library!
This PR adds an implementation of
From<bool>
forTestResult
. It allows usingTestResult::from(true)
everywhere, andtrue.into()
when theTestResult
type can be inferred from the context, which I believe improves ergonomics in some situations: