Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
attackgoat committed Nov 30, 2024
1 parent 53823d0 commit 000908e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 23 deletions.
4 changes: 3 additions & 1 deletion examples/cpu_readback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
6 changes: 1 addition & 5 deletions examples/font_bmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/driver/accel_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,13 @@ impl<T> AsRef<AccelerationStructureGeometry> 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<AccelerationStructureGeometry> for vk::AccelerationStructureGeometryKHR<'a> {
impl From<AccelerationStructureGeometry> for vk::AccelerationStructureGeometryKHR<'_> {
fn from(value: AccelerationStructureGeometry) -> Self {
Self::default()
.flags(value.flags)
Expand Down Expand Up @@ -548,7 +548,7 @@ impl From<AccelerationStructureGeometryData> for vk::GeometryTypeKHR {
}
}

impl<'a> From<AccelerationStructureGeometryData> for vk::AccelerationStructureGeometryDataKHR<'a> {
impl From<AccelerationStructureGeometryData> for vk::AccelerationStructureGeometryDataKHR<'_> {
fn from(value: AccelerationStructureGeometryData) -> Self {
match value {
AccelerationStructureGeometryData::AABBs { addr, stride } => Self {
Expand Down
2 changes: 1 addition & 1 deletion src/driver/ray_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/driver/render_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(crate) struct AttachmentInfo {
pub final_layout: vk::ImageLayout,
}

impl<'a> From<AttachmentInfo> for vk::AttachmentDescription2<'a> {
impl From<AttachmentInfo> for vk::AttachmentDescription2<'_> {
fn from(value: AttachmentInfo) -> Self {
vk::AttachmentDescription2::default()
.flags(value.flags)
Expand Down Expand Up @@ -63,7 +63,7 @@ pub(crate) struct AttachmentRef {
pub layout: vk::ImageLayout,
}

impl<'a> From<AttachmentRef> for vk::AttachmentReference2<'a> {
impl From<AttachmentRef> for vk::AttachmentReference2<'_> {
fn from(attachment_ref: AttachmentRef) -> Self {
vk::AttachmentReference2::default()
.attachment(attachment_ref.attachment)
Expand Down Expand Up @@ -527,7 +527,7 @@ impl SubpassDependency {
}
}

impl<'a> From<SubpassDependency> for vk::SubpassDependency2<'a> {
impl From<SubpassDependency> for vk::SubpassDependency2<'_> {
fn from(value: SubpassDependency) -> Self {
vk::SubpassDependency2::default()
.src_subpass(value.src_subpass)
Expand Down
20 changes: 10 additions & 10 deletions src/graph/pass_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -1053,7 +1053,7 @@ index!(Image, Image);
index!(ImageLease, Image);
index!(SwapchainImage, Image);

impl<'a> Index<AnyAccelerationStructureNode> for Bindings<'a> {
impl Index<AnyAccelerationStructureNode> for Bindings<'_> {
type Output = AccelerationStructure;

fn index(&self, node: AnyAccelerationStructureNode) -> &Self::Output {
Expand All @@ -1074,7 +1074,7 @@ impl<'a> Index<AnyAccelerationStructureNode> for Bindings<'a> {
}
}

impl<'a> Index<AnyBufferNode> for Bindings<'a> {
impl Index<AnyBufferNode> for Bindings<'_> {
type Output = Buffer;

fn index(&self, node: AnyBufferNode) -> &Self::Output {
Expand All @@ -1091,7 +1091,7 @@ impl<'a> Index<AnyBufferNode> for Bindings<'a> {
}
}

impl<'a> Index<AnyImageNode> for Bindings<'a> {
impl Index<AnyImageNode> for Bindings<'_> {
type Output = Image;

fn index(&self, node: AnyImageNode) -> &Self::Output {
Expand Down Expand Up @@ -1149,7 +1149,7 @@ pub struct Compute<'a> {
pipeline: Arc<ComputePipeline>,
}

impl<'a> Compute<'a> {
impl Compute<'_> {
/// [Dispatch] compute work items.
///
/// When the command is executed, a global workgroup consisting of
Expand Down Expand Up @@ -1590,7 +1590,7 @@ pub struct Draw<'a> {
pipeline: Arc<GraphicPipeline>,
}

impl<'a> Draw<'a> {
impl Draw<'_> {
/// Bind an index buffer to the current pass.
///
/// # Examples
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
///
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -4302,7 +4302,7 @@ pub struct RayTrace<'a> {
pipeline: Arc<RayTracePipeline>,
}

impl<'a> RayTrace<'a> {
impl RayTrace<'_> {
/// Updates push constants.
///
/// Push constants represent a high speed path to modify constant data in pipelines that is
Expand Down

0 comments on commit 000908e

Please sign in to comment.