diff --git a/examples/timestamp-queries/src/main.rs b/examples/timestamp-queries/src/main.rs index 0bdd15e47d..f8c524f03c 100644 --- a/examples/timestamp-queries/src/main.rs +++ b/examples/timestamp-queries/src/main.rs @@ -47,6 +47,7 @@ impl QueryResults { // * compute end const NUM_QUERIES: u64 = 8; + #[allow(clippy::redundant_closure)] // False positive fn from_raw_results(timestamps: Vec, timestamps_inside_passes: bool) -> Self { assert_eq!(timestamps.len(), Self::NUM_QUERIES as usize); @@ -60,9 +61,9 @@ impl QueryResults { let mut encoder_timestamps = [0, 0]; encoder_timestamps[0] = get_next_slot(); let render_start_end_timestamps = [get_next_slot(), get_next_slot()]; - let render_inside_timestamp = timestamps_inside_passes.then(get_next_slot); + let render_inside_timestamp = timestamps_inside_passes.then(|| get_next_slot()); let compute_start_end_timestamps = [get_next_slot(), get_next_slot()]; - let compute_inside_timestamp = timestamps_inside_passes.then(get_next_slot); + let compute_inside_timestamp = timestamps_inside_passes.then(|| get_next_slot()); encoder_timestamps[1] = get_next_slot(); QueryResults { diff --git a/wgpu-hal/src/metal/command.rs b/wgpu-hal/src/metal/command.rs index d5ab238c6e..a3d12f50af 100644 --- a/wgpu-hal/src/metal/command.rs +++ b/wgpu-hal/src/metal/command.rs @@ -417,19 +417,19 @@ impl crate::CommandEncoder for super::CommandEncoder { // Try to use an existing encoder for timestamp query if possible. // This works only if it's supported for the active encoder. - if let (true, Some(ref encoder)) = ( + if let (true, Some(encoder)) = ( support.contains(TimestampQuerySupport::ON_BLIT_ENCODER), - &self.state.blit, + self.state.blit.as_ref(), ) { encoder.sample_counters_in_buffer(sample_buffer, index as _, with_barrier); - } else if let (true, Some(ref encoder)) = ( + } else if let (true, Some(encoder)) = ( support.contains(TimestampQuerySupport::ON_RENDER_ENCODER), - &self.state.render, + self.state.render.as_ref(), ) { encoder.sample_counters_in_buffer(sample_buffer, index as _, with_barrier); - } else if let (true, Some(ref encoder)) = ( + } else if let (true, Some(encoder)) = ( support.contains(TimestampQuerySupport::ON_COMPUTE_ENCODER), - &self.state.compute, + self.state.compute.as_ref(), ) { encoder.sample_counters_in_buffer(sample_buffer, index as _, with_barrier); } else {