From 000908e5566fd3e40d927b2257fef9226dc159b6 Mon Sep 17 00:00:00 2001 From: John Wells Date: Fri, 29 Nov 2024 20:43:09 -0500 Subject: [PATCH] cargo clippy --- examples/cpu_readback.rs | 4 +++- examples/font_bmp.rs | 6 +----- src/driver/accel_struct.rs | 6 +++--- src/driver/ray_trace.rs | 2 +- src/driver/render_pass.rs | 6 +++--- src/graph/pass_ref.rs | 20 ++++++++++---------- 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/examples/cpu_readback.rs b/examples/cpu_readback.rs index 0a6bc7d..b0bd5a0 100644 --- a/examples/cpu_readback.rs +++ b/examples/cpu_readback.rs @@ -52,5 +52,7 @@ fn main() -> Result<(), DriverError> { println!("Waited {}μs", (Instant::now() - started).as_micros()); // It is now safe to read back what we did! - Ok(println!("{:?}", Buffer::mapped_slice(&dst_buf))) + println!("{:?}", Buffer::mapped_slice(&dst_buf)); + + Ok(()) } diff --git a/examples/font_bmp.rs b/examples/font_bmp.rs index 7fbdd31..82fc7cb 100644 --- a/examples/font_bmp.rs +++ b/examples/font_bmp.rs @@ -142,11 +142,7 @@ fn main() -> anyhow::Result<()> { .record_compute(move |compute, _| { compute .push_constants(&elapsed_time.as_secs_f32().to_ne_bytes()) - .dispatch( - (frame.width + subgroup_size - 1) / subgroup_size, - frame.height, - 1, - ); + .dispatch(frame.width.div_ceil(subgroup_size), frame.height, 1); }); // Print some text onto the image diff --git a/src/driver/accel_struct.rs b/src/driver/accel_struct.rs index e4ac0cb..3749363 100644 --- a/src/driver/accel_struct.rs +++ b/src/driver/accel_struct.rs @@ -391,13 +391,13 @@ impl AsRef for (AccelerationStructureGeometry, } } -impl<'a, 'b> From<&'b AccelerationStructureGeometry> for vk::AccelerationStructureGeometryKHR<'a> { +impl<'b> From<&'b AccelerationStructureGeometry> for vk::AccelerationStructureGeometryKHR<'_> { fn from(&value: &'b AccelerationStructureGeometry) -> Self { value.into() } } -impl<'a> From for vk::AccelerationStructureGeometryKHR<'a> { +impl From for vk::AccelerationStructureGeometryKHR<'_> { fn from(value: AccelerationStructureGeometry) -> Self { Self::default() .flags(value.flags) @@ -548,7 +548,7 @@ impl From for vk::GeometryTypeKHR { } } -impl<'a> From for vk::AccelerationStructureGeometryDataKHR<'a> { +impl From for vk::AccelerationStructureGeometryDataKHR<'_> { fn from(value: AccelerationStructureGeometryData) -> Self { match value { AccelerationStructureGeometryData::AABBs { addr, stride } => Self { diff --git a/src/driver/ray_trace.rs b/src/driver/ray_trace.rs index 9101fbb..971582a 100644 --- a/src/driver/ray_trace.rs +++ b/src/driver/ray_trace.rs @@ -225,7 +225,7 @@ impl RayTracePipeline { let pipeline = ray_trace_ext .create_ray_tracing_pipelines( vk::DeferredOperationKHR::null(), - Device::pipeline_cache(&device), + Device::pipeline_cache(device), &[vk::RayTracingPipelineCreateInfoKHR::default() .stages(&shader_stages) .groups(&shader_groups) diff --git a/src/driver/render_pass.rs b/src/driver/render_pass.rs index c06e3aa..ec3678f 100644 --- a/src/driver/render_pass.rs +++ b/src/driver/render_pass.rs @@ -25,7 +25,7 @@ pub(crate) struct AttachmentInfo { pub final_layout: vk::ImageLayout, } -impl<'a> From for vk::AttachmentDescription2<'a> { +impl From for vk::AttachmentDescription2<'_> { fn from(value: AttachmentInfo) -> Self { vk::AttachmentDescription2::default() .flags(value.flags) @@ -63,7 +63,7 @@ pub(crate) struct AttachmentRef { pub layout: vk::ImageLayout, } -impl<'a> From for vk::AttachmentReference2<'a> { +impl From for vk::AttachmentReference2<'_> { fn from(attachment_ref: AttachmentRef) -> Self { vk::AttachmentReference2::default() .attachment(attachment_ref.attachment) @@ -527,7 +527,7 @@ impl SubpassDependency { } } -impl<'a> From for vk::SubpassDependency2<'a> { +impl From for vk::SubpassDependency2<'_> { fn from(value: SubpassDependency) -> Self { vk::SubpassDependency2::default() .src_subpass(value.src_subpass) diff --git a/src/graph/pass_ref.rs b/src/graph/pass_ref.rs index 30d9d6b..bba8bba 100644 --- a/src/graph/pass_ref.rs +++ b/src/graph/pass_ref.rs @@ -78,7 +78,7 @@ pub struct Acceleration<'a> { device: &'a Device, } -impl<'a> Acceleration<'a> { +impl Acceleration<'_> { /// Build an acceleration structure. /// /// Requires a scratch buffer which was created with the following requirements: @@ -1053,7 +1053,7 @@ index!(Image, Image); index!(ImageLease, Image); index!(SwapchainImage, Image); -impl<'a> Index for Bindings<'a> { +impl Index for Bindings<'_> { type Output = AccelerationStructure; fn index(&self, node: AnyAccelerationStructureNode) -> &Self::Output { @@ -1074,7 +1074,7 @@ impl<'a> Index for Bindings<'a> { } } -impl<'a> Index for Bindings<'a> { +impl Index for Bindings<'_> { type Output = Buffer; fn index(&self, node: AnyBufferNode) -> &Self::Output { @@ -1091,7 +1091,7 @@ impl<'a> Index for Bindings<'a> { } } -impl<'a> Index for Bindings<'a> { +impl Index for Bindings<'_> { type Output = Image; fn index(&self, node: AnyImageNode) -> &Self::Output { @@ -1149,7 +1149,7 @@ pub struct Compute<'a> { pipeline: Arc, } -impl<'a> Compute<'a> { +impl Compute<'_> { /// [Dispatch] compute work items. /// /// When the command is executed, a global workgroup consisting of @@ -1590,7 +1590,7 @@ pub struct Draw<'a> { pipeline: Arc, } -impl<'a> Draw<'a> { +impl Draw<'_> { /// Bind an index buffer to the current pass. /// /// # Examples @@ -3025,7 +3025,7 @@ where } } -impl<'a> PipelinePassRef<'a, ComputePipeline> { +impl PipelinePassRef<'_, ComputePipeline> { /// Begin recording a computing command buffer. pub fn record_compute( mut self, @@ -3059,7 +3059,7 @@ impl<'a> PipelinePassRef<'a, ComputePipeline> { } } -impl<'a> PipelinePassRef<'a, GraphicPipeline> { +impl PipelinePassRef<'_, GraphicPipeline> { /// Specifies `VK_ATTACHMENT_LOAD_OP_DONT_CARE` for the render pass attachment, and loads an /// image into the framebuffer. /// @@ -4217,7 +4217,7 @@ impl<'a> PipelinePassRef<'a, GraphicPipeline> { } } -impl<'a> PipelinePassRef<'a, RayTracePipeline> { +impl PipelinePassRef<'_, RayTracePipeline> { /// Begin recording a ray tracing command buffer. pub fn record_ray_trace( mut self, @@ -4302,7 +4302,7 @@ pub struct RayTrace<'a> { pipeline: Arc, } -impl<'a> RayTrace<'a> { +impl RayTrace<'_> { /// Updates push constants. /// /// Push constants represent a high speed path to modify constant data in pipelines that is