demotes WeightedShuffle failures to error metrics (#24079) (#24088)

Since call-sites are calling unwrap anyways, panicking seems too punitive
for our use cases.

(cherry picked from commit 7cb3b6cbe2)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
This commit is contained in:
mergify[bot]
2022-04-03 18:10:00 +00:00
committed by GitHub
parent 3f661f25fb
commit ca1a282a60
6 changed files with 57 additions and 32 deletions

View File

@@ -32,8 +32,7 @@ fn bench_weighted_shuffle_new(bencher: &mut Bencher) {
let weights = make_weights(&mut rng);
bencher.iter(|| {
rng.fill(&mut seed[..]);
let shuffle = WeightedShuffle::new(&weights).unwrap();
shuffle
WeightedShuffle::new("", &weights)
.shuffle(&mut ChaChaRng::from_seed(seed))
.collect::<Vec<_>>()
});