Skip to content

Commit 8c7f6af

Browse files
committed
I think this shrinks better.
1 parent d27b47b commit 8c7f6af

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/testsuite/support/resolver.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,13 @@ pub fn registry_strategy(
355355
) -> impl Strategy<Value = PrettyPrintRegistry> {
356356
let name = string_regex("[A-Za-z][A-Za-z0-9_-]*(-sys)?").unwrap();
357357

358-
let raw_version = [..max_versions; 3];
359-
let version_from_raw = |v: &[usize; 3]| format!("{}.{}.{}", v[0], v[1], v[2]);
358+
let raw_version = ..max_versions.pow(3);
359+
let version_from_raw = move |r: usize| {
360+
let major = ((r / max_versions) / max_versions) % max_versions;
361+
let minor = (r / max_versions) % max_versions;
362+
let patch = r % max_versions;
363+
format!("{}.{}.{}", major, minor, patch)
364+
};
360365

361366
// If this is false than the crate will depend on the nonexistent "bad"
362367
// instead of the complex set we generated for it.
@@ -365,7 +370,7 @@ pub fn registry_strategy(
365370
let list_of_versions =
366371
btree_map(raw_version, allow_deps, 1..=max_versions).prop_map(move |ver| {
367372
ver.into_iter()
368-
.map(|a| (version_from_raw(&a.0), a.1))
373+
.map(|a| (version_from_raw(a.0), a.1))
369374
.collect::<Vec<_>>()
370375
});
371376

0 commit comments

Comments
 (0)