From 8fd8e7d575661b6ad567bc277716142ff4867e47 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Thu, 17 Feb 2022 09:45:45 -0500 Subject: [PATCH] Address Jim's notes --- .github/workflows/pipeline.yml | 2 +- benches/criterion.rs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 8f687e169a..b19fd9a8b7 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -29,7 +29,7 @@ jobs: # we could use `test` but `criterion` is a dev dependency, # and it doesn't build with our MSRV command: check - # `cli` already enables most features, so let's add the rest, + # `cli` already enables most features, # except for `arbitrary`, which requires Rust-1.51 args: --workspace - name: Check snapshots diff --git a/benches/criterion.rs b/benches/criterion.rs index 4c3ead31b5..f239948e88 100644 --- a/benches/criterion.rs +++ b/benches/criterion.rs @@ -59,12 +59,15 @@ fn frontends(c: &mut Criterion) { }); #[cfg(feature = "wgsl-in")] group.bench_function("wgsl", |b| { - let inputs = gather_inputs("tests/in", "wgsl"); + let inputs_wgsl = gather_inputs("tests/in", "wgsl"); + let inputs = inputs_wgsl + .iter() + .map(|input| std::str::from_utf8(input).unwrap()) + .collect::>(); let mut parser = naga::front::wgsl::Parser::new(); b.iter(move || { - for input in inputs.iter() { - let string = std::str::from_utf8(input).unwrap(); - parser.parse(string).unwrap(); + for &input in inputs.iter() { + parser.parse(input).unwrap(); } }); });