Skip to content

Commit

Permalink
Resolve lint warnings for deprecated_in_future, rust_2018_idioms
Browse files Browse the repository at this point in the history
…and `unused_qualifications` (#803)

* generator: Add many missing lifetime parameters

* Globally find-replace common patterns that need a `<'_>` lifetime annotation

    perl -pi -E "s/(&(mut )?\[?vk::(?\!\w+(V1_\d|Fn|<))\w+)/\$1<'_>/" **/*.{rs,md}

* generator: Include aliased types in `has_lifetime` lookup table

* Manually revert wrong find-replace lifetimes

* Resolve lint warnings for `deprecated_in_future`, `rust_2018_idioms` and `unused_qualifications`

These are 3 non-default lints that cause a lot of violations in this
project that are sensible to resolve, and reduce noise when
test-including a local `ash` checkout in other projects that have
stricter lint setups.
  • Loading branch information
MarijnS95 authored Oct 26, 2023
1 parent 2d2aeac commit ff54d22
Show file tree
Hide file tree
Showing 81 changed files with 1,956 additions and 1,828 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ The Vulkan Video bindings are experimental and still seeing breaking changes in
```rust
// function signature
pub fn create_instance(&self,
create_info: &vk::InstanceCreateInfo,
allocation_callbacks: Option<&vk::AllocationCallbacks>)
create_info: &vk::InstanceCreateInfo<'_>,
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>)
-> Result<Instance, InstanceError> { .. }
let instance = entry.create_instance(&create_info, None)
.expect("Instance creation error");
Expand All @@ -59,9 +59,9 @@ pub fn cmd_pipeline_barrier(&self,
src_stage_mask: vk::PipelineStageFlags,
dst_stage_mask: vk::PipelineStageFlags,
dependency_flags: vk::DependencyFlags,
memory_barriers: &[vk::MemoryBarrier],
buffer_memory_barriers: &[vk::BufferMemoryBarrier],
image_memory_barriers: &[vk::ImageMemoryBarrier]);
memory_barriers: &[vk::MemoryBarrier<'_>],
buffer_memory_barriers: &[vk::BufferMemoryBarrier<'_>],
image_memory_barriers: &[vk::ImageMemoryBarrier<'_>]);
```

### Strongly typed handles
Expand Down Expand Up @@ -181,7 +181,7 @@ Handles from Instance or Device are passed implicitly.

```rust
pub fn create_command_pool(&self,
create_info: &vk::CommandPoolCreateInfo)
create_info: &vk::CommandPoolCreateInfo<'_>)
-> VkResult<vk::CommandPool>;

let pool = device.create_command_pool(&pool_create_info).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion ash-window/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub unsafe fn create_surface(
instance: &Instance,
display_handle: RawDisplayHandle,
window_handle: RawWindowHandle,
allocation_callbacks: Option<&vk::AllocationCallbacks>,
allocation_callbacks: Option<&vk::AllocationCallbacks<'_>>,
) -> VkResult<vk::SurfaceKHR> {
match (display_handle, window_handle) {
(RawDisplayHandle::Windows(_), RawWindowHandle::Win32(window)) => {
Expand Down
Loading

0 comments on commit ff54d22

Please sign in to comment.