Skip to content

Commit

Permalink
Merge pull request #281 from mikerite/refactor-20221116
Browse files Browse the repository at this point in the history
Simplify non_zero arbitrary impl
  • Loading branch information
matthew-russo authored Jan 6, 2023
2 parents 932c1d6 + 2055d39 commit d666b7e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions proptest/src/arbitrary/non_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ macro_rules! non_zero_impl {
FilterMap<StrategyFor<$prim>, fn($prim) -> Option<Self>>;

fn arbitrary_with((): Self::Parameters) -> Self::Strategy {
any::<$prim>().prop_filter_map(
"must be non zero",
|i| match i {
0 => None,
i => Some(Self::try_from(i).unwrap()),
},
)
any::<$prim>().prop_filter_map("must be non zero", |i| {
Self::try_from(i).ok()
})
}
}
};
Expand Down

0 comments on commit d666b7e

Please sign in to comment.