fix: Use TryFrom instead of as to get noisy conversion errors

pull/24376/head
Carol (Nichols || Goulding) 2020-02-14 11:40:36 -05:00
parent 575907814c
commit 6463601676
1 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ fn benchmark_encode<T>(
) {
let mut group = c.benchmark_group(benchmark_group_name);
for &batch_size in batch_sizes {
group.throughput(Throughput::Bytes(batch_size as u64 * 8));
group.throughput(Throughput::Bytes(u64::try_from(batch_size).unwrap() * 8));
group.bench_with_input(
BenchmarkId::from_parameter(batch_size),
&batch_size,
@ -63,7 +63,7 @@ fn benchmark_decode<T>(
let mut group = c.benchmark_group(benchmark_group_name);
for &batch_size in batch_sizes {
let (decoded_len, encoded) = input_value_generation(batch_size);
group.throughput(Throughput::Bytes(encoded.len() as u64));
group.throughput(Throughput::Bytes(u64::try_from(encoded.len()).unwrap()));
group.bench_with_input(
BenchmarkId::from_parameter(batch_size),
&decoded_len,