We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents fb2ed7b + 7562c45 commit 9e3b7f8Copy full SHA for 9e3b7f8
src/arbitrary.rs
@@ -9,6 +9,7 @@ use std::collections::{
9
VecDeque,
10
};
11
use std::hash::Hash;
12
+use std::iter::{empty, once};
13
use std::ops::{Range, RangeFrom, RangeTo, RangeFull};
14
use entropy_pool::EntropyPool;
15
use shrink::{Shrinker, StdShrinker};
@@ -113,12 +114,12 @@ impl<R: Rng> Gen for StdGen<R> {
113
114
115
/// Creates a shrinker with zero elements.
116
pub fn empty_shrinker<A: 'static>() -> Box<Iterator<Item=A>> {
- Box::new(None.into_iter())
117
+ Box::new(empty())
118
}
119
120
/// Creates a shrinker with a single element.
121
pub fn single_shrinker<A: 'static>(value: A) -> Box<Iterator<Item=A>> {
- Box::new(Some(value).into_iter())
122
+ Box::new(once(value))
123
124
125
/// `Arbitrary` describes types whose values can be randomly generated and
0 commit comments