More Clippy (#2381)

* More Clippy

* This looks nicer indeed
This commit is contained in:
Dominik Maier 2024-07-12 11:05:03 +02:00 committed by GitHub
parent 4931db6469
commit 081c218737
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 9 deletions

View File

@ -520,19 +520,15 @@ mod tests {
log::trace!("{:?}", input.bytes()); log::trace!("{:?}", input.bytes());
// The pre-seeded rand should have spliced at position 2. // The pre-seeded rand should have spliced at position 2.
assert_eq!(input.bytes(), &[b'a', b'b', b'f']); assert_eq!(input.bytes(), b"abf");
} }
#[test] #[test]
fn test_havoc() { fn test_havoc() {
let rand = StdRand::with_seed(0x1337); let rand = StdRand::with_seed(0x1337);
let mut corpus: InMemoryCorpus<BytesInput> = InMemoryCorpus::new(); let mut corpus: InMemoryCorpus<BytesInput> = InMemoryCorpus::new();
corpus corpus.add(Testcase::new(b"abc".to_vec().into())).unwrap();
.add(Testcase::new(vec![b'a', b'b', b'c'].into())) corpus.add(Testcase::new(b"def".to_vec().into())).unwrap();
.unwrap();
corpus
.add(Testcase::new(vec![b'd', b'e', b'f'].into()))
.unwrap();
let mut input = corpus.cloned_input_for_id(corpus.first().unwrap()).unwrap(); let mut input = corpus.cloned_input_for_id(corpus.first().unwrap()).unwrap();
let input_prior = input.clone(); let input_prior = input.clone();

View File

@ -25,14 +25,14 @@ fn criterion_benchmark(c: &mut Criterion) {
let mut hasher = let mut hasher =
black_box(ahash::RandomState::with_seeds(123, 456, 789, 123).build_hasher()); black_box(ahash::RandomState::with_seeds(123, 456, 789, 123).build_hasher());
hasher.write(black_box(&bench_vec)); hasher.write(black_box(&bench_vec));
hasher.finish(); black_box(hasher.finish());
}); });
}); });
c.bench_function("fxhash", |b| { c.bench_function("fxhash", |b| {
b.iter(|| { b.iter(|| {
let mut hasher = black_box(rustc_hash::FxHasher::default()); let mut hasher = black_box(rustc_hash::FxHasher::default());
hasher.write(black_box(&bench_vec)); hasher.write(black_box(&bench_vec));
hasher.finish(); black_box(hasher.finish());
}); });
}); });
} }