Debian Codegraph @

src/arbitrary.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::{
3 BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#, BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#, BinaryHeaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/BinaryHeap#, HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#, LinkedListrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/LinkedList#, VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#,
4 };
5 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/;
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::{CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#, OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#};
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::hashrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/::{BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher#, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#};
8 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::{emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty()., oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once()., successorsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/successors/successors().};
9 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::netrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/::{
10 IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr#, Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#, SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#, SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#,
11 };
12 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#;
13 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::{
14 NonZeroU128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU128#, NonZeroU16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU16#, NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32#, NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64#, NonZeroU8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU8#, NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize#,
15 };
16 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{
17 Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#, Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#, RangeFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#, RangeFullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#, RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#, RangeTorust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#,
18 RangeToInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#,
19 };
20 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#;
21 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#;
22 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::{Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#, SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#, UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/UNIX_EPOCH.};
23
24 use randrust-analyzer cargo rand 0.10.0 crate/::preluderust-analyzer cargo rand 0.10.0 prelude/::*;
25
26 /// `Gen` represents a PRNG.
27 ///
28 /// It is the source of randomness from which QuickCheck will generate values.
29 /// An instance of `Gen` is passed to every invocation of
30 /// `Arbitrary::arbitrary`, which permits callers to use lower level RNG
31 /// routines to generate values.
32 ///
33 /// It is unspecified whether this is a secure RNG or not. Therefore, callers
34 /// should assume it is insecure.
35 pub struct Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen# {
36 rngrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#rng.: randrust-analyzer cargo rand 0.10.0 crate/::rngsrust-analyzer cargo rand 0.10.0 rngs/::SmallRngrust-analyzer cargo rand 0.10.0 rngs/small/SmallRng#,
37 sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#size.: usize,
38 }
39
40 impl Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen# {
41 /// Returns a `Gen` with a random seed and the given size configuration.
42 ///
43 /// The `size` parameter controls the size of random values generated.
44 /// For example, it specifies the maximum length of a randomly generated
45 /// vector, but is and should not be used to control the range of a
46 /// randomly generated number. (Unless that number is used to control the
47 /// size of a data structure.)
48 pub fn newrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]new().(size: usize) -> Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen# {
49 Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen# { rngrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#rng.: randrust-analyzer cargo rand 0.10.0 crate/::make_rngrust-analyzer cargo rand 0.10.0 make_rng().(), sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#size.: size }
50 }
51
52 /// Returns a `Gen` with the given seed and a default size configuration.
53 ///
54 /// Two `Gen`s created with the same seed will generate the same values.
55 /// Though the values may vary between QuickCheck releases.
56 ///
57 /// The `size` parameter controls the size of random values generated.
58 /// For example, it specifies the maximum length of a randomly generated
59 /// vector, but is and should not be used to control the range of a
60 /// randomly generated number. (Unless that number is used to control the
61 /// size of a data structure.)
62 pub fn from_size_and_seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]from_size_and_seed().(size: usize, seed: u64) -> Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen# {
63 Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen# { rngrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#rng.: randrust-analyzer cargo rand 0.10.0 crate/::rngsrust-analyzer cargo rand 0.10.0 rngs/::SmallRngrust-analyzer cargo rand 0.10.0 rngs/small/SmallRng#::seed_from_u64rust-analyzer cargo rand 0.10.0 rngs/small/impl#[SmallRng][SeedableRng]seed_from_u64().(seed), sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#size. }
64 }
65
66 /// Returns the size configured with this generator.
67 pub fn sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]size().(&self) -> usize {
68 self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#size.
69 }
70
71 /// Choose among the possible alternatives in the slice given. If the slice
72 /// is empty, then `None` is returned. Otherwise, a non-`None` value is
73 /// guaranteed to be returned.
74 pub fn chooserust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]choose().<'a, T>(&mut self, slice: &'a [T]) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&'a T> {
75 slice.chooserust-analyzer cargo rand 0.10.0 seq/slice/IndexedRandom#choose().(&mut self.rngrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#rng.)
76 }
77
78 fn randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().<T>(&mut self) -> T
79 where
80 randrust-analyzer cargo rand 0.10.0 crate/::distrrust-analyzer cargo rand 0.10.0 distr/::StandardUniformrust-analyzer cargo rand 0.10.0 distr/StandardUniform#: randrust-analyzer cargo rand 0.10.0 crate/::distrrust-analyzer cargo rand 0.10.0 distr/::Distributionrust-analyzer cargo rand 0.10.0 distr/distribution/Distribution#<T>,
81 {
82 self.rngrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#rng..randomrust-analyzer cargo rand 0.10.0 rng/RngExt#random().()
83 }
84
85 fn random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().<T, R>(&mut self, range: R) -> T
86 where
87 T: randrust-analyzer cargo rand 0.10.0 crate/::distrrust-analyzer cargo rand 0.10.0 distr/::uniformrust-analyzer cargo rand 0.10.0 distr/uniform/::SampleUniformrust-analyzer cargo rand 0.10.0 distr/uniform/SampleUniform#,
88 R: randrust-analyzer cargo rand 0.10.0 crate/::distrrust-analyzer cargo rand 0.10.0 distr/::uniformrust-analyzer cargo rand 0.10.0 distr/uniform/::SampleRangerust-analyzer cargo rand 0.10.0 distr/uniform/SampleRange#<T>,
89 {
90 self.rngrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#rng..random_rangerust-analyzer cargo rand 0.10.0 rng/RngExt#random_range().(range)
91 }
92 }
93
94 /// Creates a shrinker with zero elements.
95 pub fn empty_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/empty_shrinker().<A: 'static>() -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = A>> {
96 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/empty/empty().())
97 }
98
99 /// Creates a shrinker with a single element.
100 pub fn single_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/single_shrinker().<A: 'static>(value: A) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = A>> {
101 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(value))
102 }
103
104 /// `Arbitrary` describes types whose values can be randomly generated and
105 /// shrunk.
106 ///
107 /// Aside from shrinking, `Arbitrary` is different from typical RNGs in that it
108 /// respects `Gen::size()` for controlling how much memory a particular value
109 /// uses, for practical purposes. For example, `Vec::arbitrary()` respects
110 /// `Gen::size()` to decide the maximum `len()` of the vector. This behavior is
111 /// necessary due to practical speed and size limitations. Conversely,
112 /// `i32::arbitrary()` ignores `size()` since all `i32` values require `O(1)`
113 /// memory and operations between `i32`s require `O(1)` time (with the
114 /// exception of exponentiation).
115 ///
116 /// Additionally, all types that implement `Arbitrary` must also implement
117 /// `Clone`.
118 pub trait Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + 'static {
119 /// Return an arbitrary value.
120 ///
121 /// Implementations should respect `Gen::size()` when decisions about how
122 /// big a particular value should be. Implementations should generally
123 /// defer to other `Arbitrary` implementations to generate other random
124 /// values when necessary. The `Gen` type also offers a few RNG helper
125 /// routines.
126 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Self;
127
128 /// Return an iterator of values that are smaller than itself.
129 ///
130 /// The way in which a value is "smaller" is implementation defined. In
131 /// some cases, the interpretation is obvious: shrinking an integer should
132 /// produce integers smaller than itself. Others are more complex, for
133 /// example, shrinking a `Vec` should both shrink its size and shrink its
134 /// component values.
135 ///
136 /// The iterator returned should be bounded to some reasonable size.
137 ///
138 /// It is always correct to return an empty iterator, and indeed, this
139 /// is the default implementation. The downside of this approach is that
140 /// witnesses to failures in properties will be more inscrutable.
141 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Self>> {
142 empty_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/empty_shrinker().()
143 }
144 }
145
146 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for () {
147 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`()`][Arbitrary]arbitrary().(_: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) {}
148 }
149
150 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for bool {
151 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[bool][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> bool {
152 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().()
153 }
154
155 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[bool][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = bool>> {
156 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
157 single_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/single_shrinker().(false)
158 } else {
159 empty_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/empty_shrinker().()
160 }
161 }
162 }
163
164 impl<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<A> {
165 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Option<A>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<A> {
166 if g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().() {
167 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
168 } else {
169 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g))
170 }
171 }
172
173 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Option<A>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<A>>> {
174 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
175 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => empty_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/empty_shrinker().(),
176 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref x) => {
177 let chain = single_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/single_shrinker().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#).chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(x.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#));
178 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(chain)
179 }
180 }
181 }
182 }
183
184 impl<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#, B: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<A, B> {
185 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Result<A, B>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<A, B> {
186 if g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().() {
187 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g))
188 } else {
189 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g))
190 }
191 }
192
193 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Result<A, B>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<A, B>>> {
194 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
195 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ref x) => {
196 let xs = x.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().();
197 let tagged = xs.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#);
198 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(tagged)
199 }
200 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ref x) => {
201 let xs = x.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().();
202 let tagged = xs.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#);
203 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(tagged)
204 }
205 }
206 }
207 }
208
209 macro_rules! impl_arb_for_single_tuplerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl_arb_for_single_tuple! {
210 ($(($type_param:ident, $tuple_index:tt),)*) => {
211 impl<$($type_param),*> Arbitrary for ($($type_param,)*)
212 where $($type_param: Arbitrary,)*
213 {
214 fn arbitrary(g: &mut Gen) -> ($($type_param,)*) {
215 (
216 $(
217 $type_param::arbitrary(g),
218 )*
219 )
220 }
221
222 fn shrink(&self) -> Box<dyn Iterator<Item=($($type_param,)*)>> {
223 let iter = ::std::iter::empty();
224 $(
225 let cloned = self.clone();
226 let iter = iter.chain(
227 self.$tuple_index.shrink().map(move |shr_value| {
228 let mut result = cloned.clone();
229 result.$tuple_index = shr_value;
230 result
231 })
232 );
233 )*
234 Box::new(iter)
235 }
236 }
237 };
238 }
239
240 macro_rules! impl_arb_for_tuplesrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl_arb_for_tuples! {
241 (@internal [$($acc:tt,)*]) => { };
242 (@internal [$($acc:tt,)*] ($type_param:ident, $tuple_index:tt), $($rest:tt,)*) => {
243 impl_arb_for_single_tuple!($($acc,)* ($type_param, $tuple_index),);
244 impl_arb_for_tuples!(@internal [$($acc,)* ($type_param, $tuple_index),] $($rest,)*);
245 };
246 ($(($type_param:ident, $tuple_index:tt),)*) => {
247 impl_arb_for_tuples!(@internal [] $(($type_param, $tuple_index),)*);
248 };
249 }
250
251 impl_arb_for_tuplesrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl_arb_for_tuples!! {
252 (A, 0),
253 (B, 1),
254 (C, 2),
255 (D, 3),
256 (E, 4),
257 (F, 5),
258 (G, 6),
259 (H, 7),
260 }
261
262 impl<const N: usize, A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for [A; N] {
263 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`[A; N]`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`[A; N]`][Arbitrary] {
264 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::arrayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/::from_fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/from_fn().(|_ix| A::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g))
265 }
266
267 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`[A; N]`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = [A; N]>> {
268 let cloned = self.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().();
269 let iter = (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#N).flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(move |n| {
270 let cloned = cloned.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().();
271 cloned[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(move |shr_value| {
272 let mut result = cloned.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().();
273 result[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = shr_value;
274 result
275 })
276 });
277
278 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(iter)
279 }
280 }
281
282 impl<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A> {
283 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A> {
284 let size = {
285 let s = g.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]size().();
286 g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#s)
287 };
288 (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#size).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|_| A::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
289 }
290
291 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>>> {
292 VecShrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#::newrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecShrinker<A>`]new().(self.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().())
293 }
294 }
295
296 ///Iterator which returns successive attempts to shrink the vector `seed`
297 struct VecShrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#<A> {
298 seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>,
299 /// How much which is removed when trying with smaller vectors
300 sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size.: usize,
301 /// The end of the removed elements
302 offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset.: usize,
303 /// The shrinker for the element at `offset` once shrinking of individual
304 /// elements are attempted
305 element_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#element_shrinker.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = A>>,
306 }
307
308 impl<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> VecShrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#<A> {
309 #[allow(clippy::new_ret_no_self)]
310 fn newrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecShrinker<A>`]new().(seed: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>>> {
311 let es = match seed.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().() {
312 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e) => e.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().(),
313 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return empty_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/empty_shrinker().(),
314 };
315 let size = seed.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().();
316 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(VecShrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker# {
317 seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed.,
318 sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size.,
319 offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset.: size,
320 element_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#element_shrinker.: es,
321 })
322 }
323
324 /// Returns the next shrunk element if any, `offset` points to the index
325 /// after the returned element after the function returns
326 fn next_elementrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecShrinker<A>`]next_element().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<A> {
327 loop {
328 match self.element_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#element_shrinker..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/iter/impl#[`Box<I, A>`][Iterator]next().() {
329 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e) => return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e),
330 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => match self.seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset.) {
331 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e) => {
332 self.element_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#element_shrinker. = e.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().();
333 self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
334 }
335 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
336 },
337 }
338 }
339 }
340 }
341
342 impl<A> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for VecShrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#<A>
343 where
344 A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#,
345 {
346 type Itemrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecShrinker<A>`][Iterator]Item# = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>;
347 fn nextrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecShrinker<A>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>> {
348 // Try with an empty vector first
349 if self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().self.seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() {
350 self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`DivAssign<Self>`]div_assign()./=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`DivAssign<Self>`]div_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`DivAssign<Self>`]div_assign().2;
351 self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. = self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size.;
352 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
353 }
354 if self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 {
355 // Generate a smaller vector by removing the elements between
356 // (offset - size) and offset
357 let xs1 = self.seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#(self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size.)]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().
358 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
359 .chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(&self.seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().)
360 .clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().()
361 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
362 self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size.;
363 // Try to reduce the amount removed from the vector once all
364 // previous sizes tried
365 if self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().self.seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() {
366 self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`DivAssign<Self>`]div_assign()./=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`DivAssign<Self>`]div_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`DivAssign<Self>`]div_assign().2;
367 self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. = self.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#size.;
368 }
369 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(xs1)
370 } else {
371 // A smaller vector did not work so try to shrink each element of
372 // the vector instead Reuse `offset` as the index determining which
373 // element to shrink
374
375 // The first element shrinker is already created so skip the first
376 // offset (self.offset == 0 only on first entry to this part of the
377 // iterator)
378 if self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 {
379 self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. = 1;
380 }
381
382 match self.next_elementrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecShrinker<A>`]next_element().() {
383 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(
384 self.seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().
385 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
386 .clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().()
387 .chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e))
388 .chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(self.seedrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#seed.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().self.offsetrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#offset...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().())
389 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
390 ),
391 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
392 }
393 }
394 }
395 }
396
397 impl<K: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, V: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<K, V> {
398 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`BTreeMap<K, V>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<K, V> {
399 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(K, V)> = Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g);
400 vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
401 }
402
403 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`BTreeMap<K, V>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<K, V>>> {
404 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(K, V)> = self.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
405 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(
406 vec.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| v.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<K, V>>()),
407 )
408 }
409 }
410
411 impl<
412 K: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#,
413 V: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#,
414 S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + 'static,
415 > Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<K, V, S>
416 {
417 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashMap<K, V, S>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashMap<K, V, S>`][Arbitrary] {
418 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(K, V)> = Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g);
419 vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
420 }
421
422 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashMap<K, V, S>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashMap<K, V, S>`][Arbitrary]>> {
423 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(K, V)> = self.clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][Clone]clone().().into_iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
424 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(vec.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| v.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashMap<K, V, S>`][Arbitrary]>()))
425 }
426 }
427
428 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<T> {
429 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`BTreeSet<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<T> {
430 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g);
431 vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
432 }
433
434 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`BTreeSet<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<T>>> {
435 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = self.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
436 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(vec.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| v.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<T>>()))
437 }
438 }
439
440 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for BinaryHeaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/BinaryHeap#<T> {
441 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`BinaryHeap<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> BinaryHeaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/BinaryHeap#<T> {
442 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g);
443 vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
444 }
445
446 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`BinaryHeap<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = BinaryHeaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/BinaryHeap#<T>>> {
447 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = self.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/impl#[`BinaryHeap<T, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/impl#[`BinaryHeap<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
448 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(
449 vec.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| v.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<BinaryHeaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/BinaryHeap#<T>>()),
450 )
451 }
452 }
453
454 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, S: BuildHasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasher# + Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + 'static>
455 Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<T, S>
456 {
457 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashSet<T, S>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashSet<T, S>`][Arbitrary] {
458 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g);
459 vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
460 }
461
462 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashSet<T, S>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashSet<T, S>`][Arbitrary]>> {
463 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = self.clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`][Clone]clone().().into_iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
464 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(vec.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| v.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`HashSet<T, S>`][Arbitrary]>()))
465 }
466 }
467
468 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for LinkedListrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/LinkedList#<T> {
469 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`LinkedList<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> LinkedListrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/LinkedList#<T> {
470 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g);
471 vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
472 }
473
474 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`LinkedList<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = LinkedListrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/LinkedList#<T>>> {
475 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = self.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/impl#[`LinkedList<T, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/impl#[`LinkedList<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
476 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(
477 vec.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| v.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<LinkedListrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/LinkedList#<T>>()),
478 )
479 }
480 }
481
482 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<T> {
483 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecDeque<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<T> {
484 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g);
485 vec.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
486 }
487
488 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecDeque<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<T>>> {
489 let vec: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> = self.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
490 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(vec.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| v.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<T>>()))
491 }
492 }
493
494 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr# {
495 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[IpAddr][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr# {
496 let ipv4: bool = g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().();
497 if ipv4 {
498 IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr#::V4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr#V4#(Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Ipv4Addr][Arbitrary]arbitrary().(g))
499 } else {
500 IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr#::V6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr#V6#(Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Ipv6Addr][Arbitrary]arbitrary().(g))
501 }
502 }
503 }
504
505 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr# {
506 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Ipv4Addr][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr# {
507 Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]new().(g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(), g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(), g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(), g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().())
508 }
509 }
510
511 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr# {
512 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Ipv6Addr][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr# {
513 Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]new().(
514 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
515 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
516 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
517 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
518 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
519 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
520 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
521 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
522 )
523 }
524 }
525
526 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr# {
527 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[SocketAddr][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr# {
528 SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddr]new().(Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[IpAddr][Arbitrary]arbitrary().(g), g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().())
529 }
530 }
531
532 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4# {
533 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[SocketAddrV4][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4# {
534 SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV4]new().(Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Ipv4Addr][Arbitrary]arbitrary().(g), g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().())
535 }
536 }
537
538 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6# {
539 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[SocketAddrV6][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6# {
540 SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV6]new().(
541 Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Ipv6Addr][Arbitrary]arbitrary().(g),
542 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
543 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
544 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().(),
545 )
546 }
547 }
548
549 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf# {
550 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[PathBuf][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf# {
551 // use some real directories as guesses, so we may end up with
552 // actual working directories in case that is relevant.
553 let here = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::current_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/current_dir().()
554 .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_else().(|_| PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/test/directory"));
555 let temp = envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::temp_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/temp_dir().();
556 #[allow(deprecated)]
557 let home =
558 envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::home_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/home_dir().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/user"));
559 let mut p = g
560 .chooserust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]choose().(&[
561 here,
562 temp,
563 home,
564 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("."),
565 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().(".."),
566 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("../../.."),
567 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]new().(),
568 ])
569 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
570 .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().();
571 p.extendrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`Extend<P>`]extend().(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]arbitrary().(g).iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().());
572 p
573 }
574
575 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[PathBuf][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>> {
576 let mut shrunk = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
577 let mut popped = self.clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().();
578 if popped.poprust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]pop().() {
579 shrunk.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(popped);
580 }
581
582 // Iterating over a Path performs a small amount of normalization.
583 let normalized = self.iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>();
584 if normalized.as_os_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]as_os_str().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().self.as_os_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]as_os_str().() {
585 shrunk.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(normalized);
586 }
587
588 // Add the canonicalized variant only if canonicalizing the path
589 // actually does something, making it (hopefully) smaller. Also, ignore
590 // canonicalization if canonicalization errors.
591 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(canonicalized) = self.canonicalizerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]canonicalize().() {
592 if canonicalized.as_os_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]as_os_str().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().self.as_os_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]as_os_str().() {
593 shrunk.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(canonicalized);
594 }
595 }
596
597 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(shrunk.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().())
598 }
599 }
600
601 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString# {
602 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[OsString][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString# {
603 OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`From<String>`]from().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[String][Arbitrary]arbitrary().(g))
604 }
605
606 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[OsString][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>> {
607 let mystring: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = self.clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][Clone]clone().().into_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]into_string().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
608 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(mystring.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[String][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`From<String>`]from().))
609 }
610 }
611
612 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
613 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[String][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
614 let size = {
615 let s = g.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]size().();
616 g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#s)
617 };
618 (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#size).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|_| char::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[char][Arbitrary]arbitrary().(g)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
619 }
620
621 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[String][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>> {
622 // Shrink a string by shrinking a vector of its characters.
623 let chars: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<char> = self.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
624 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(chars.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Vec<A>`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|x| x.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>()))
625 }
626 }
627
628 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString# {
629 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[CString][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[CString][Arbitrary] {
630 let size = {
631 let s = g.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]size().();
632 g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#s)
633 };
634 // Use either random bytes or random UTF-8 encoded codepoints.
635 let utf8: bool = g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().();
636 if utf8 {
637 CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString]new().(
638 (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#)
639 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|_| char::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[char][Arbitrary]arbitrary().(g))
640 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne().'\0')
641 .takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(size)
642 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>(),
643 )
644 } else {
645 CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString]new().(
646 (0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#)
647 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|_| u8::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[u8][Arbitrary]arbitrary().(g))
648 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().b'\0')
649 .takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(size)
650 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>>(),
651 )
652 }
653 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("null characters should have been filtered out")
654 }
655
656 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[CString][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#>> {
657 // Use the implementation for a vec here, but make sure null characters
658 // are filtered out.
659 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(VecShrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/VecShrinker#::newrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`VecShrinker<A>`]new().(self.as_bytesrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString]as_bytes().().to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().()).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|bytes| {
660 CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString]new().(
661 bytes.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>>(),
662 )
663 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("null characters should have been filtered out")
664 }))
665 }
666 }
667
668 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for char {
669 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[char][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> char {
670 let mode = g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#100);
671 match mode {
672 0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#49 => {
673 // ASCII + some control characters
674 g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0u8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0xB0) as char
675 }
676 50..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#59 => {
677 // Unicode BMP characters
678 loop {
679 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) = charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/::from_u32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/from_u32().(g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0x10000))
680 {
681 return x;
682 }
683 // ignore surrogate pairs
684 }
685 }
686 60..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#84 => {
687 // Characters often used in programming languages
688 g.chooserust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]choose().(&[
689 ' ', ' ', ' ', '\t', '\n', '~', '`', '!', '@', '#', '$',
690 '%', '^', '&', '*', '(', ')', '_', '-', '=', '+', '[',
691 ']', '{', '}', ':', ';', '\'', '"', '\\', '|', ',', '<',
692 '>', '.', '/', '?', '0', '1', '2', '3', '4', '5', '6',
693 '7', '8', '9',
694 ])
695 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
696 .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().()
697 }
698 85..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#89 => {
699 // Tricky Unicode, part 1
700 g.chooserust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]choose().(&[
701 '\u{0149}', // a deprecated character
702 '\u{fff0}', // some of "Other, format" category:
703 '\u{fff1}',
704 '\u{fff2}',
705 '\u{fff3}',
706 '\u{fff4}',
707 '\u{fff5}',
708 '\u{fff6}',
709 '\u{fff7}',
710 '\u{fff8}',
711 '\u{fff9}',
712 '\u{fffA}',
713 '\u{fffB}',
714 '\u{fffC}',
715 '\u{fffD}',
716 '\u{fffE}',
717 '\u{fffF}',
718 '\u{0600}',
719 '\u{0601}',
720 '\u{0602}',
721 '\u{0603}',
722 '\u{0604}',
723 '\u{0605}',
724 '\u{061C}',
725 '\u{06DD}',
726 '\u{070F}',
727 '\u{180E}',
728 '\u{110BD}',
729 '\u{1D173}',
730 '\u{e0001}', // tag
731 '\u{e0020}', // tag space
732 '\u{e000}',
733 '\u{e001}',
734 '\u{ef8ff}', // private use
735 '\u{f0000}',
736 '\u{ffffd}',
737 '\u{ffffe}',
738 '\u{fffff}',
739 '\u{100000}',
740 '\u{10FFFD}',
741 '\u{10FFFE}',
742 '\u{10FFFF}',
743 // "Other, surrogate" characters are so that very special
744 // that they are not even allowed in safe Rust,
745 //so omitted here
746 '\u{3000}', // ideographic space
747 '\u{1680}',
748 // other space characters are already covered by two next
749 // branches
750 ])
751 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
752 .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().()
753 }
754 90..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#94 => {
755 // Tricky unicode, part 2
756 charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/::from_u32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/from_u32().(g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0x2000..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0x2070)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
757 }
758 95..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#99 => {
759 // Completely arbitrary characters
760 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().()
761 }
762 _ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(),
763 }
764 }
765
766 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[char][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = char>> {
767 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self as u32).shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[u32][Arbitrary]shrink().().filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/::from_u32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/from_u32().))
768 }
769 }
770
771 macro_rules! unsigned_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_shrinker! {
772 ($ty:ty) => {
773 mod shrinker {
774 pub struct UnsignedShrinker {
775 x: $ty,
776 i: $ty,
777 }
778
779 impl UnsignedShrinker {
780 #[allow(clippy::new_ret_no_self)]
781 pub fn new(x: $ty) -> Box<dyn Iterator<Item = $ty>> {
782 if x == 0 {
783 super::empty_shrinker()
784 } else {
785 Box::new(
786 vec![0]
787 .into_iter()
788 .chain(UnsignedShrinker { x, i: x / 2 }),
789 )
790 }
791 }
792 }
793
794 impl Iterator for UnsignedShrinker {
795 type Item = $ty;
796 fn next(&mut self) -> Option<$ty> {
797 if self.x - self.i < self.x {
798 let result = Some(self.x - self.i);
799 self.i /= 2;
800 result
801 } else {
802 None
803 }
804 }
805 }
806 }
807 };
808 }
809
810 macro_rules! unsigned_problem_valuesrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_problem_values! {
811 ($t:ty) => {
812 &[<$t>::MIN, 1, <$t>::MAX]
813 };
814 }
815
816 macro_rules! unsigned_arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_arbitrary! {
817 ($($ty:tt),*) => {
818 $(
819 impl Arbitrary for $ty {
820 fn arbitrary(g: &mut Gen) -> $ty {
821 match g.random_range(0..10) {
822 0 => *g.choose(unsigned_problem_values!($ty)).unwrap(),
823 _ => g.random()
824 }
825 }
826 fn shrink(&self) -> Box<dyn Iterator<Item=$ty>> {
827 unsigned_shrinker!($ty);
828 shrinker::UnsignedShrinker::new(*self)
829 }
830 }
831 )*
832 }
833 }
834
835 unsigned_arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_arbitrary!! {
836 u8, u16, u32, u64, u128
837 }
838
839 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for usize {
840 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[usize][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> usize {
841 match g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10) {
842 0 => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().g.chooserust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]choose().(unsigned_problem_valuesrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_problem_values!!(usize)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
843 _ => {
844 #[cfg(target_pointer_width = "16")]
845 {
846 g.random::<u16>() as usize
847 }
848 #[cfg(target_pointer_width = "32")]
849 {
850 g.random::<u32>() as usize
851 }
852 #[cfg(target_pointer_width = "64")]
853 {
854 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().::<u64>() as usize
855 }
856 }
857 }
858 }
859 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[usize][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = usize>> {
860 unsigned_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_shrinker!!(usize);
861 shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/shrinker/::UnsignedShrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/shrinker/UnsignedShrinker#::newrust-analyzer cargo quickcheck 1.1.0 arbitrary/shrinker/impl#[UnsignedShrinker]new().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)
862 }
863 }
864
865 macro_rules! signed_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/signed_shrinker! {
866 ($ty:ty) => {
867 mod shrinker {
868 pub struct SignedShrinker {
869 x: $ty,
870 i: $ty,
871 }
872
873 impl SignedShrinker {
874 #[allow(clippy::new_ret_no_self)]
875 pub fn new(x: $ty) -> Box<dyn Iterator<Item = $ty>> {
876 if x == 0 {
877 super::empty_shrinker()
878 } else {
879 let shrinker = SignedShrinker { x, i: x / 2 };
880 let mut items = vec![0];
881 if shrinker.i < 0 && shrinker.x != <$ty>::MIN {
882 items.push(shrinker.x.abs());
883 }
884 Box::new(items.into_iter().chain(shrinker))
885 }
886 }
887 }
888
889 impl Iterator for SignedShrinker {
890 type Item = $ty;
891 fn next(&mut self) -> Option<$ty> {
892 if self.i != 0 {
893 let result = Some(self.x - self.i);
894 self.i /= 2;
895 result
896 } else {
897 None
898 }
899 }
900 }
901 }
902 };
903 }
904
905 macro_rules! signed_problem_valuesrust-analyzer cargo quickcheck 1.1.0 arbitrary/signed_problem_values! {
906 ($t:ty) => {
907 &[<$t>::MIN, 0, <$t>::MAX]
908 };
909 }
910
911 macro_rules! signed_arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/signed_arbitrary! {
912 ($($ty:tt),*) => {
913 $(
914 impl Arbitrary for $ty {
915 fn arbitrary(g: &mut Gen) -> $ty {
916 match g.random_range(0..10) {
917 0 => *g.choose(signed_problem_values!($ty)).unwrap(),
918 _ => g.random()
919 }
920 }
921 fn shrink(&self) -> Box<dyn Iterator<Item=$ty>> {
922 signed_shrinker!($ty);
923 shrinker::SignedShrinker::new(*self)
924 }
925 }
926 )*
927 }
928 }
929
930 signed_arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/signed_arbitrary!! {
931 i8, i16, i32, i64, i128
932 }
933
934 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for isize {
935 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[isize][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> isize {
936 match g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#10) {
937 0 => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().g.chooserust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]choose().(signed_problem_valuesrust-analyzer cargo quickcheck 1.1.0 arbitrary/signed_problem_values!!(isize)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
938 _ => {
939 #[cfg(target_pointer_width = "16")]
940 {
941 g.random::<i16>() as isize
942 }
943 #[cfg(target_pointer_width = "32")]
944 {
945 g.random::<i32>() as isize
946 }
947 #[cfg(target_pointer_width = "64")]
948 {
949 g.randomrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random().::<i64>() as isize
950 }
951 }
952 }
953 }
954 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[isize][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = isize>> {
955 signed_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/signed_shrinker!!(isize);
956 shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/shrinker/::SignedShrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/shrinker/SignedShrinker#::newrust-analyzer cargo quickcheck 1.1.0 arbitrary/shrinker/impl#[SignedShrinker]new().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self)
957 }
958 }
959
960 macro_rules! float_problem_valuesrust-analyzer cargo quickcheck 1.1.0 arbitrary/float_problem_values! {
961 ($t:ty) => {{
962 &[
963 <$t>::NAN,
964 <$t>::NEG_INFINITY,
965 <$t>::MIN,
966 -0.,
967 0.,
968 <$t>::MAX,
969 <$t>::INFINITY,
970 ]
971 }};
972 }
973
974 macro_rules! float_arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/float_arbitrary! {
975 ($($t:ty, $shrinkable:ty),+) => {$(
976 impl Arbitrary for $t {
977 fn arbitrary(g: &mut Gen) -> $t {
978 match g.random_range(0..10) {
979 0 => *g.choose(float_problem_values!($t)).unwrap(),
980 _ => {
981 let exp = g.random_range((0.)..<$t>::MAX_EXP as i16 as $t);
982 let mantissa = g.random_range((1.)..2.);
983 let sign = *g.choose(&[-1., 1.]).unwrap();
984 sign * mantissa * exp.exp2()
985 }
986 }
987 }
988 fn shrink(&self) -> Box<dyn Iterator<Item = $t>> {
989 signed_shrinker!($shrinkable);
990 let it = shrinker::SignedShrinker::new(*self as $shrinkable);
991 let old = *self;
992 Box::new(it.map(|x| x as $t).filter(move |x| *x != old))
993 }
994 }
995 )*};
996 }
997
998 float_arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/float_arbitrary!!(f32, i32, f64, i64);
999
1000 macro_rules! unsigned_non_zero_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_non_zero_shrinker! {
1001 ($ty:tt) => {
1002 mod shrinker {
1003 pub struct UnsignedNonZeroShrinker {
1004 x: $ty,
1005 i: $ty,
1006 }
1007
1008 impl UnsignedNonZeroShrinker {
1009 #[allow(clippy::new_ret_no_self)]
1010 pub fn new(x: $ty) -> Box<dyn Iterator<Item = $ty>> {
1011 debug_assert!(x > 0);
1012
1013 if x == 1 {
1014 super::empty_shrinker()
1015 } else {
1016 Box::new(
1017 std::iter::once(1).chain(
1018 UnsignedNonZeroShrinker { x, i: x / 2 },
1019 ),
1020 )
1021 }
1022 }
1023 }
1024
1025 impl Iterator for UnsignedNonZeroShrinker {
1026 type Item = $ty;
1027
1028 fn next(&mut self) -> Option<$ty> {
1029 if self.x - self.i < self.x {
1030 let result = Some(self.x - self.i);
1031 self.i /= 2;
1032 result
1033 } else {
1034 None
1035 }
1036 }
1037 }
1038 }
1039 };
1040 }
1041
1042 macro_rules! unsigned_non_zero_arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_non_zero_arbitrary! {
1043 ($($ty:tt => $inner:tt),*) => {
1044 $(
1045 impl Arbitrary for $ty {
1046 fn arbitrary(g: &mut Gen) -> $ty {
1047 let mut v = $inner::arbitrary(g);
1048 if v == 0 {
1049 v += 1;
1050 }
1051 $ty::new(v).expect("non-zero value construction failed")
1052 }
1053
1054 fn shrink(&self) -> Box<dyn Iterator<Item = $ty>> {
1055 unsigned_non_zero_shrinker!($inner);
1056 Box::new(shrinker::UnsignedNonZeroShrinker::new(self.get())
1057 .map($ty::new)
1058 .map(Option::unwrap))
1059 }
1060 }
1061 )*
1062 }
1063 }
1064
1065 unsigned_non_zero_arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/unsigned_non_zero_arbitrary!! {
1066 NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize# => usize,
1067 NonZeroU8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU8# => u8,
1068 NonZeroU16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU16# => u16,
1069 NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32# => u32,
1070 NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64# => u64,
1071 NonZeroU128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU128# => u128
1072 }
1073
1074 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#<T> {
1075 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Wrapping<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#<T> {
1076 Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(T::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g))
1077 }
1078 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Wrapping<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#<T>>> {
1079 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(self.0rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#0..shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#))
1080 }
1081 }
1082
1083 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<T> {
1084 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Bound<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<T> {
1085 match g.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3) {
1086 0 => Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(T::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)),
1087 1 => Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(T::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)),
1088 _ => Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#,
1089 }
1090 }
1091 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Bound<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<T>>> {
1092 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
1093 Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(ref x) => {
1094 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(x.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#))
1095 }
1096 Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(ref x) => {
1097 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(x.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#))
1098 }
1099 Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded# => empty_shrinkerrust-analyzer cargo quickcheck 1.1.0 arbitrary/empty_shrinker().(),
1100 }
1101 }
1102 }
1103
1104 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#<T> {
1105 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Range<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#<T> {
1106 Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)
1107 }
1108 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Range<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#<T>>> {
1109 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(
1110 (self.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#start..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), self.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()).shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`(A, B)`][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(s, e)| s..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#e),
1111 )
1112 }
1113 }
1114
1115 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<T> {
1116 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`RangeInclusive<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<T> {
1117 Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)
1118 }
1119 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`RangeInclusive<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<T>>> {
1120 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(
1121 (self.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]start().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), self.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`RangeInclusive<Idx>`]end().().clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
1122 .shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`(A, B)`][Arbitrary]shrink().()
1123 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(s, e)| s..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#e),
1124 )
1125 }
1126 }
1127
1128 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for RangeFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#<T> {
1129 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`RangeFrom<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> RangeFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#<T> {
1130 Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#
1131 }
1132 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`RangeFrom<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = RangeFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#<T>>> {
1133 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(self.startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#start..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|start| start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#))
1134 }
1135 }
1136
1137 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for RangeTorust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#<T> {
1138 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`RangeTo<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> RangeTorust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#<T> {
1139 ..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)
1140 }
1141 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`RangeTo<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = RangeTorust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#<T>>> {
1142 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(self.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#end..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|end| ..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#end))
1143 }
1144 }
1145
1146 impl<T: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for RangeToInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#<T> {
1147 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`RangeToInclusive<T>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> RangeToInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#<T> {
1148 ..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g)
1149 }
1150 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`RangeToInclusive<T>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = RangeToInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#<T>>> {
1151 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(self.endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#end..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|end| ..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#end))
1152 }
1153 }
1154
1155 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for RangeFullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull# {
1156 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[RangeFull][Arbitrary]arbitrary().(_: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> RangeFullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull# {
1157 ..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#
1158 }
1159 }
1160
1161 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration# {
1162 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Duration][Arbitrary]arbitrary().(rng: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Duration][Arbitrary] {
1163 let seconds = rng.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#rng.sizerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]size().() as u64);
1164 let nanoseconds = rng.random_rangerust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]random_range().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1_000_000);
1165 Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]new().(seconds, nanoseconds)
1166 }
1167
1168 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Duration][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Duration][Arbitrary]>> {
1169 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(
1170 (self.as_secsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]as_secs().(), self.subsec_nanosrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]subsec_nanos().())
1171 .shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`(A, B)`][Arbitrary]shrink().()
1172 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(secs, nanos)| Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]new().(secs, nanos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u32][`Rem<Self>`]rem().1_000_000)),
1173 )
1174 }
1175 }
1176
1177 impl<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<A> {
1178 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Box<A>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<A> {
1179 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(A::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g))
1180 }
1181
1182 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Box<A>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<A>>> {
1183 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().((*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().))
1184 }
1185 }
1186
1187 impl<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<A> {
1188 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Arc<A>`][Arbitrary]arbitrary().(g: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<A> {
1189 Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(A::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(g))
1190 }
1191
1192 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`Arc<A>`][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<A>>> {
1193 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().((*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Deref]deref().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().))
1194 }
1195 }
1196
1197 impl Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime# {
1198 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[SystemTime][Arbitrary]arbitrary().(rng: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[SystemTime][Arbitrary] {
1199 let after_epoch = bool::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[bool][Arbitrary]arbitrary().(rng);
1200 let duration = Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Duration][Arbitrary]arbitrary().(rng);
1201 successorsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/successors/successors().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(duration), |d| Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().d rust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration][`Div<u32>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration][`Div<u32>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration][`Div<u32>`]div().2))
1202 .take_whilerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take_while().(|d| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().d.is_zerorust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]is_zero().())
1203 .find_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find_map().(|d| {
1204 if after_epoch {
1205 UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/UNIX_EPOCH..checked_addrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]checked_add().(d)
1206 } else {
1207 UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/UNIX_EPOCH..checked_subrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]checked_sub().(d)
1208 }
1209 })
1210 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/UNIX_EPOCH.)
1211 }
1212
1213 fn shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[SystemTime][Arbitrary]shrink().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[SystemTime][Arbitrary]>> {
1214 let duration = match self.duration_sincerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]duration_since().(UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/UNIX_EPOCH.) {
1215 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(duration) => duration,
1216 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => e.durationrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTimeError]duration().(),
1217 };
1218 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(
1219 duration
1220 .shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Duration][Arbitrary]shrink().()
1221 .flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|d| vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/UNIX_EPOCH. +rust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime][`Add<Duration>`]add(). d, UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/UNIX_EPOCH. -rust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime][`Sub<Duration>`]sub(). d]),
1222 )
1223 }
1224 }
1225
1226 /// Wrapper for disabling shrinking for an Arbitrary
1227 ///
1228 /// This type allows generating values via a given `Arbitrary` implementation
1229 /// for a test for which we don't want to shrink input values.
1230 ///
1231 /// # Example
1232 ///
1233 /// ```rust
1234 /// use quickcheck::{QuickCheck, NoShrink};
1235 ///
1236 /// fn prop_sane_shrinker() {
1237 /// // Yielding the original value will result in endless shrinking
1238 /// fn shrinker_no_self(value: NoShrink<u16>) -> bool {
1239 /// use quickcheck::Arbitrary;
1240 /// !value.inner().shrink().any(|v| v == *value.inner())
1241 /// }
1242 /// QuickCheck::new().quickcheck(shrinker_no_self as fn(NoShrink<u16>) -> bool);
1243 /// }
1244 /// ```
1245 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
1246 pub struct NoShrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/NoShrink#<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> {
1247 innerrust-analyzer cargo quickcheck 1.1.0 arbitrary/NoShrink#inner.: A,
1248 }
1249
1250 impl<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> NoShrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/NoShrink#<A> {
1251 /// Unwrap the inner value
1252 pub fn into_innerrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`NoShrink<A>`]into_inner().(self) -> A {
1253 self.innerrust-analyzer cargo quickcheck 1.1.0 arbitrary/NoShrink#inner.
1254 }
1255
1256 /// Returns a borrow of the inner value.
1257 pub fn innerrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`NoShrink<A>`]inner().(&self) -> &A {
1258 &self.innerrust-analyzer cargo quickcheck 1.1.0 arbitrary/NoShrink#inner.
1259 }
1260 }
1261
1262 impl<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#> Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# for NoShrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/NoShrink#<A> {
1263 fn arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`NoShrink<A>`][Arbitrary]arbitrary().(rnd: &mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#) -> Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`NoShrink<A>`][Arbitrary] {
1264 Selfrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[`NoShrink<A>`][Arbitrary] { innerrust-analyzer cargo quickcheck 1.1.0 arbitrary/NoShrink#inner.: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(rnd) }
1265 }
1266 }
1267
1268 #[cfg(test)]
1269 mod testrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ {
1270 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::{
1271 BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#, BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#, BinaryHeaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/BinaryHeap#, HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#, LinkedListrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/LinkedList#, VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#,
1272 };
1273 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#;
1274 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::hashrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/::Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#;
1275 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#;
1276 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#;
1277
1278 use superrust-analyzer cargo quickcheck 1.1.0 arbitrary/::{Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#, Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#};
1279
1280 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1281 fn arby_unitrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_unit().() {
1282 let _: () = arbyrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby().::<()>();
1283 }
1284
1285 macro_rules! arby_intrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_int! {
1286 ( $signed:expr, $($t:ty),+) => {$(
1287 let mut arbys = (0..1_000_000).map(|_| arby::<$t>());
1288 let mut problems = if $signed {
1289 signed_problem_values!($t).iter()
1290 } else {
1291 unsigned_problem_values!($t).iter()
1292 };
1293 assert!(problems.all(|p| arbys.any(|arby| arby == *p)),
1294 "Arbitrary does not generate all problematic values");
1295 let max = <$t>::MAX;
1296 let mid = (max + <$t>::MIN) / 2;
1297 // split full range of $t into chunks
1298 // Arbitrary must return some value in each chunk
1299 let double_chunks: $t = 9;
1300 let chunks = double_chunks * 2; // chunks must be even
1301 let lim: Box<dyn Iterator<Item=$t>> = if $signed {
1302 Box::new((0..=chunks)
1303 .map(|idx| idx - chunks / 2)
1304 .map(|x| mid + max / (chunks / 2) * x))
1305 } else {
1306 Box::new((0..=chunks).map(|idx| max / chunks * idx))
1307 };
1308 let mut lim = lim.peekable();
1309 while let (Some(low), Some(&high)) = (lim.next(), lim.peek()) {
1310 assert!(arbys.any(|arby| low <= arby && arby <= high),
1311 "Arbitrary doesn't generate numbers in {}..={}", low, high)
1312 }
1313 )*};
1314 }
1315
1316 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1317 fn arby_intrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_int().() {
1318 arby_intrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_int!!(true, i8, i16, i32, i64, isize, i128);
1319 }
1320
1321 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1322 fn arby_uintrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_uint().() {
1323 arby_intrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_int!!(false, u8, u16, u32, u64, usize, u128);
1324 }
1325
1326 macro_rules! arby_floatrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_float! {
1327 ($($t:ty),+) => {$({
1328 let mut arbys = (0..1_000_000).map(|_| arby::<$t>());
1329 //NaN != NaN
1330 assert!(arbys.any(|f| f.is_nan()),
1331 "Arbitrary does not generate the problematic value NaN"
1332 );
1333 for p in float_problem_values!($t).iter().filter(|f| !f.is_nan()) {
1334 assert!(arbys.any(|arby| arby == *p),
1335 "Arbitrary does not generate the problematic value {}",
1336 p
1337 );
1338 }
1339 // split full range of $t into chunks
1340 // Arbitrary must return some value in each chunk
1341 let double_chunks: i8 = 9;
1342 let chunks = double_chunks * 2; // chunks must be even
1343 let lim = (-double_chunks..=double_chunks)
1344 .map(|idx| <$t>::from(idx))
1345 .map(|idx| <$t>::MAX/(<$t>::from(chunks/2)) * idx);
1346 let mut lim = lim.peekable();
1347 while let (Some(low), Some(&high)) = (lim.next(), lim.peek()) {
1348 assert!(
1349 arbys.any(|arby| low <= arby && arby <= high),
1350 "Arbitrary doesn't generate numbers in {:e}..={:e}",
1351 low,
1352 high,
1353 )
1354 }
1355 })*};
1356 }
1357
1358 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1359 fn arby_floatrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_float().() {
1360 arby_floatrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby_float!!(f32, f64);
1361 }
1362
1363 fn arbyrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/arby().<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#>() -> A {
1364 Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#::arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#arbitrary().(&mut Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#::newrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]new().(5))
1365 }
1366
1367 // Shrink testing.
1368 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1369 fn unitrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/unit().() {
1370 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().((), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1371 }
1372
1373 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1374 fn boolsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/bools().() {
1375 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(false, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1376 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(true, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![false]);
1377 }
1378
1379 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1380 fn optionsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/options().() {
1381 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#::<()>, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1382 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#]);
1383 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false)]);
1384 }
1385
1386 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1387 fn resultsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/results().() {
1388 // Result<A, B> doesn't implement the Hash trait, so these tests
1389 // depends on the order of shrunk results. Ug.
1390 // TODO: Fix this.
1391 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#::<bool, ()>(true), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false)]);
1392 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#::<(), bool>(true), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(false)]);
1393 }
1394
1395 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1396 fn tuplesrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/tuples().() {
1397 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().((false, false), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1398 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().((true, false), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(false, false)]);
1399 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().((true, true), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(false, true), (true, false)]);
1400 }
1401
1402 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1403 fn triplesrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/triples().() {
1404 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().((false, false, false), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1405 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().((true, false, false), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(false, false, false)]);
1406 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(
1407 (true, true, false),
1408 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(false, true, false), (true, false, false)],
1409 );
1410 }
1411
1412 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1413 fn quadsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/quads().() {
1414 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().((false, false, false, false), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1415 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().((true, false, false, false), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(false, false, false, false)]);
1416 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(
1417 (true, true, false, false),
1418 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(false, true, false, false), (true, false, false, false)],
1419 );
1420 }
1421
1422 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1423 fn intsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ints().() {
1424 // TODO: Test overflow?
1425 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5isize, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1426 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().5isize, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![5, 0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().3, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().4]);
1427 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0isize, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1428 }
1429
1430 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1431 fn ints8rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ints8().() {
1432 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5i8, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1433 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().5i8, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![5, 0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().3, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().4]);
1434 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0i8, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1435 }
1436
1437 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1438 fn ints16rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ints16().() {
1439 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5i16, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1440 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().5i16, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![5, 0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().3, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i16][Neg]neg().4]);
1441 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0i16, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1442 }
1443
1444 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1445 fn ints32rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ints32().() {
1446 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5i32, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1447 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().5i32, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![5, 0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().3, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().4]);
1448 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0i32, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1449 }
1450
1451 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1452 fn ints64rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ints64().() {
1453 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5i64, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1454 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().5i64, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![5, 0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().3, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i64][Neg]neg().4]);
1455 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0i64, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1456 }
1457
1458 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1459 fn ints128rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ints128().() {
1460 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5i128, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1461 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i128][Neg]neg().5i128, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![5, 0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i128][Neg]neg().3, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i128][Neg]neg().4]);
1462 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0i128, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1463 }
1464
1465 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1466 fn uintsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/uints().() {
1467 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5usize, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1468 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0usize, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1469 }
1470
1471 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1472 fn uints8rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/uints8().() {
1473 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5u8, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1474 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0u8, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1475 }
1476
1477 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1478 fn uints16rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/uints16().() {
1479 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5u16, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1480 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0u16, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1481 }
1482
1483 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1484 fn uints32rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/uints32().() {
1485 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5u32, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1486 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0u32, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1487 }
1488
1489 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1490 fn uints64rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/uints64().() {
1491 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5u64, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1492 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0u64, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1493 }
1494
1495 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1496 fn uints128rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/uints128().() {
1497 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(5u128, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 3, 4]);
1498 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0u128, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1499 }
1500
1501 macro_rules! define_float_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/define_float_eq! {
1502 ($ty:ty) => {
1503 fn eq(s: $ty, v: Vec<$ty>) {
1504 let shrunk: Vec<$ty> = s.shrink().collect();
1505 for n in v {
1506 let found = shrunk.iter().any(|&i| i == n);
1507 if !found {
1508 panic!(
1509 "Element {:?} was not found \
1510 in shrink results {:?}",
1511 n, shrunk
1512 );
1513 }
1514 }
1515 }
1516 };
1517 }
1518
1519 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1520 fn floats32rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/floats32().() {
1521 define_float_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/define_float_eq!!(f32);
1522
1523 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1524 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().0.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1525 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(1.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.0]);
1526 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(2.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.0, 1.0]);
1527 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().2.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.0, 2.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.0]);
1528 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(1.5, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.0]);
1529 }
1530
1531 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1532 fn floats64rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/floats64().() {
1533 define_float_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/define_float_eq!!(f64);
1534
1535 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(0.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1536 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().0.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1537 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(1.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.0]);
1538 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(2.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.0, 1.0]);
1539 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().2.0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.0, 2.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1.0]);
1540 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(1.5, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.0]);
1541 }
1542
1543 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1544 fn wrapping_ints32rust-analyzer cargo quickcheck 1.1.0 arbitrary/test/wrapping_ints32().() {
1545 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(5i32), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(0), Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(3), Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(4)]);
1546 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(
1547 Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().5i32),
1548 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(5), Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(0), Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().3), Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().4)],
1549 );
1550 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(Wrappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/wrapping/Wrapping#(0i32), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1551 }
1552
1553 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1554 fn vecsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/vecs().() {
1555 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(
1556 {
1557 let it: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<isize> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
1558 it
1559 },
1560 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
1561 );
1562 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(
1563 {
1564 let it: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<isize>> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]];
1565 it
1566 },
1567 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]],
1568 );
1569 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1isize], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0]]);
1570 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![11isize], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![6], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![9], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![10]]);
1571 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(
1572 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3isize, 5],
1573 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1574 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
1575 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![5],
1576 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3],
1577 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0, 5],
1578 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![2, 5],
1579 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3, 0],
1580 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3, 3],
1581 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3, 4],
1582 ],
1583 );
1584 }
1585
1586 macro_rules! map_testsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/map_tests! {
1587 ($name:ident, $ctor:expr) => {
1588 #[test]
1589 fn $name() {
1590 ordered_eq($ctor, vec![]);
1591
1592 {
1593 let mut map = $ctor;
1594 map.insert(1usize, 1isize);
1595
1596 let shrinks = vec![
1597 $ctor,
1598 {
1599 let mut m = $ctor;
1600 m.insert(0, 1);
1601 m
1602 },
1603 {
1604 let mut m = $ctor;
1605 m.insert(1, 0);
1606 m
1607 },
1608 ];
1609
1610 ordered_eq(map, shrinks);
1611 }
1612 }
1613 };
1614 }
1615
1616 map_testsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/map_tests!!(btreemaprust-analyzer cargo quickcheck 1.1.0 arbitrary/test/btreemap()., BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::<usize, isize>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().());
1617 map_testsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/map_tests!!(hashmaprust-analyzer cargo quickcheck 1.1.0 arbitrary/test/hashmap()., HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::<usize, isize>::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().());
1618
1619 macro_rules! list_testsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/list_tests! {
1620 ($name:ident, $ctor:expr, $push:ident) => {
1621 #[test]
1622 fn $name() {
1623 ordered_eq($ctor, vec![]);
1624
1625 {
1626 let mut list = $ctor;
1627 list.$push(2usize);
1628
1629 let shrinks = vec![
1630 $ctor,
1631 {
1632 let mut m = $ctor;
1633 m.$push(0);
1634 m
1635 },
1636 {
1637 let mut m = $ctor;
1638 m.$push(1);
1639 m
1640 },
1641 ];
1642
1643 ordered_eq(list, shrinks);
1644 }
1645 }
1646 };
1647 }
1648
1649 list_testsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/list_tests!!(btreesetsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/btreesets()., BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#::<usize>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T>`]new().(), insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/impl#[`BTreeSet<T, A>`]insert().);
1650 list_testsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/list_tests!!(hashsetsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/hashsets()., HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::<usize>::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().(), insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().);
1651 list_testsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/list_tests!!(linkedlistsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/linkedlists()., LinkedListrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/LinkedList#::<usize>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/impl#[`LinkedList<T>`]new().(), push_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/linked_list/impl#[`LinkedList<T, A>`]push_back().);
1652 list_testsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/list_tests!!(vecdequesrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/vecdeques()., VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#::<usize>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T>`]new().(), push_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]push_back().);
1653
1654 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1655 fn binaryheapsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/binaryheaps().() {
1656 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(
1657 BinaryHeaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/BinaryHeap#::<usize>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/impl#[`BinaryHeap<T>`]new().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/impl#[`BinaryHeap<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
1658 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
1659 );
1660
1661 {
1662 let mut heap = BinaryHeaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/BinaryHeap#::<usize>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/impl#[`BinaryHeap<T>`]new().();
1663 heap.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/impl#[`BinaryHeap<T, A>`]push().(2usize);
1664
1665 let shrinks = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0], vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1]];
1666
1667 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(heap.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/binary_heap/impl#[`BinaryHeap<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), shrinks);
1668 }
1669 }
1670
1671 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1672 fn charsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/chars().() {
1673 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().('\x00', vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1674 }
1675
1676 // All this jazz is for testing set equality on the results of a shrinker.
1677 fn eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#>(s: A, v: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>) {
1678 let (left, right) = (shrunkrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/shrunk().(s), setrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/set().(v));
1679 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(left, right);
1680 }
1681 fn shrunkrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/shrunk().<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#>(s: A) -> HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<A> {
1682 setrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/set().(s.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().())
1683 }
1684 fn setrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/set().<A: Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq#, I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = A>>(xs: I) -> HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<A> {
1685 xs.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
1686 }
1687
1688 fn ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().<A: Arbitraryrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary# + Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# + Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#>(s: A, v: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>) {
1689 let (left, right) = (s.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/Arbitrary#shrink().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<A>>(), v);
1690 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(left, right);
1691 }
1692
1693 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1694 fn boundsrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/bounds().() {
1695 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::*;
1696 for i in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][Neg]neg().5..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5 {
1697 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(i), i.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[i32][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().());
1698 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(i), i.shrinkrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[i32][Arbitrary]shrink().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().());
1699 }
1700 eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/eq().(Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#::<i32>, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1701 }
1702
1703 #[allow(clippy::reversed_empty_ranges)]
1704 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1705 fn rangesrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ranges().() {
1706 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1707 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0..1, 1..0]);
1708 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#5, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0..5, 2..5, 3..0, 3..3, 3..4]);
1709 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(5..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0..3, 3..3, 4..3, 5..0, 5..2]);
1710 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0.., 2..]);
1711 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#3, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![..0, ..2]);
1712 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]);
1713 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(3..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0..=5, 2..=5, 3..=0, 3..=3, 3..=4]);
1714 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#3, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![..=0, ..=2]);
1715 }
1716
1717 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1718 fn pathbufrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/pathbuf().() {
1719 ordered_eqrust-analyzer cargo quickcheck 1.1.0 arbitrary/test/ordered_eq().(
1720 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/foo//.././bar"),
1721 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
1722 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/foo//.."),
1723 PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/foo/../bar"),
1724 ],
1725 );
1726 }
1727 }