From 434330ca3af445439b890cc3ce6a896c2634ed83 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 27 Apr 2021 12:12:38 +0200 Subject: [PATCH] Fix clippy::use_self in extension modules (#423) * Fix clippy::use_self warnings in extension modules * Deny clippy::use_self in extension modules Note that clippy::use_self generates some false positives that must be ignored --- ash/src/extensions/experimental/amd.rs | 136 +++++++++--------- .../extensions/ext/buffer_device_address.rs | 4 +- ash/src/extensions/ext/debug_marker.rs | 4 +- ash/src/extensions/ext/debug_report.rs | 4 +- ash/src/extensions/ext/debug_utils.rs | 4 +- .../extensions/ext/full_screen_exclusive.rs | 4 +- ash/src/extensions/ext/metal_surface.rs | 4 +- ash/src/extensions/ext/tooling_info.rs | 4 +- ash/src/extensions/khr/android_surface.rs | 4 +- .../extensions/khr/buffer_device_address.rs | 4 +- ash/src/extensions/khr/create_render_pass2.rs | 4 +- ash/src/extensions/khr/display.rs | 4 +- ash/src/extensions/khr/display_swapchain.rs | 4 +- ash/src/extensions/khr/draw_indirect_count.rs | 5 +- .../khr/get_memory_requirements2.rs | 4 +- .../khr/get_physical_device_properties2.rs | 7 +- ash/src/extensions/khr/maintenance1.rs | 4 +- ash/src/extensions/khr/maintenance3.rs | 4 +- .../khr/pipeline_executable_properties.rs | 8 +- ash/src/extensions/khr/push_descriptor.rs | 5 +- ash/src/extensions/khr/surface.rs | 4 +- ash/src/extensions/khr/swapchain.rs | 4 +- ash/src/extensions/khr/timeline_semaphore.rs | 5 +- ash/src/extensions/khr/wayland_surface.rs | 4 +- ash/src/extensions/khr/win32_surface.rs | 4 +- ash/src/extensions/khr/xcb_surface.rs | 4 +- ash/src/extensions/khr/xlib_surface.rs | 4 +- ash/src/extensions/mod.rs | 1 + ash/src/extensions/mvk/ios_surface.rs | 4 +- ash/src/extensions/mvk/macos_surface.rs | 4 +- ash/src/extensions/nn/vi_surface.rs | 4 +- .../nv/device_diagnostic_checkpoints.rs | 7 +- ash/src/extensions/nv/mesh_shader.rs | 8 +- ash/src/extensions/nv/ray_tracing.rs | 4 +- 34 files changed, 139 insertions(+), 143 deletions(-) diff --git a/ash/src/extensions/experimental/amd.rs b/ash/src/extensions/experimental/amd.rs index b01ef48..648f28f 100644 --- a/ash/src/extensions/experimental/amd.rs +++ b/ash/src/extensions/experimental/amd.rs @@ -39,6 +39,10 @@ vk_bitflags_wrapped!( 0b1111111111111111111111111111111, Flags ); +// ignore clippy::use_self false positives +// changing GpaSqShaderStageFlags::PS.0 to Self::PS.0 as suggested by clippy generates: +// error[E0401]: can't use generic parameters from outer function +#[allow(clippy::use_self)] impl fmt::Debug for GpaSqShaderStageFlags { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { const KNOWN: &[(Flags, &str)] = &[ @@ -54,21 +58,21 @@ impl fmt::Debug for GpaSqShaderStageFlags { } } impl GpaSqShaderStageFlags { - pub const PS: Self = GpaSqShaderStageFlags(0b1); - pub const VS: Self = GpaSqShaderStageFlags(0b10); - pub const GS: Self = GpaSqShaderStageFlags(0b100); - pub const ES: Self = GpaSqShaderStageFlags(0b1000); - pub const HS: Self = GpaSqShaderStageFlags(0b10000); - pub const LS: Self = GpaSqShaderStageFlags(0b100000); - pub const CS: Self = GpaSqShaderStageFlags(0b1000000); + pub const PS: Self = Self(0b1); + pub const VS: Self = Self(0b10); + pub const GS: Self = Self(0b100); + pub const ES: Self = Self(0b1000); + pub const HS: Self = Self(0b10000); + pub const LS: Self = Self(0b100000); + pub const CS: Self = Self(0b1000000); } impl StructureType { - pub const PHYSICAL_DEVICE_GPA_FEATURES_AMD: Self = StructureType(1000133000); - pub const PHYSICAL_DEVICE_GPA_PROPERTIES_AMD: Self = StructureType(1000133001); - pub const GPA_SAMPLE_BEGIN_INFO_AMD: Self = StructureType(1000133002); - pub const GPA_SESSION_CREATE_INFO_AMD: Self = StructureType(1000133003); - pub const GPA_DEVICE_CLOCK_MODE_INFO_AMD: Self = StructureType(1000133004); + pub const PHYSICAL_DEVICE_GPA_FEATURES_AMD: Self = Self(1000133000); + pub const PHYSICAL_DEVICE_GPA_PROPERTIES_AMD: Self = Self(1000133001); + pub const GPA_SAMPLE_BEGIN_INFO_AMD: Self = Self(1000133002); + pub const GPA_SESSION_CREATE_INFO_AMD: Self = Self(1000133003); + pub const GPA_DEVICE_CLOCK_MODE_INFO_AMD: Self = Self(1000133004); } #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] @@ -76,19 +80,19 @@ impl StructureType { pub struct GpaDeviceClockModeAmd(pub(crate) i32); impl GpaDeviceClockModeAmd { pub fn from_raw(x: i32) -> Self { - GpaDeviceClockModeAmd(x) + Self(x) } pub fn as_raw(self) -> i32 { self.0 } } impl GpaDeviceClockModeAmd { - pub const DEFAULT: Self = GpaDeviceClockModeAmd(0); - pub const QUERY: Self = GpaDeviceClockModeAmd(1); - pub const PROFILING: Self = GpaDeviceClockModeAmd(2); - pub const MIN_MEMORY: Self = GpaDeviceClockModeAmd(3); - pub const MIN_ENGINE: Self = GpaDeviceClockModeAmd(4); - pub const PEAK: Self = GpaDeviceClockModeAmd(5); + pub const DEFAULT: Self = Self(0); + pub const QUERY: Self = Self(1); + pub const PROFILING: Self = Self(2); + pub const MIN_MEMORY: Self = Self(3); + pub const MIN_ENGINE: Self = Self(4); + pub const PEAK: Self = Self(5); } #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] @@ -96,45 +100,45 @@ impl GpaDeviceClockModeAmd { pub struct GpaPerfBlockAmd(pub(crate) i32); impl GpaPerfBlockAmd { pub fn from_raw(x: i32) -> Self { - GpaPerfBlockAmd(x) + Self(x) } pub fn as_raw(self) -> i32 { self.0 } } impl GpaPerfBlockAmd { - pub const CPF: Self = GpaPerfBlockAmd(0); - pub const IA: Self = GpaPerfBlockAmd(1); - pub const VGT: Self = GpaPerfBlockAmd(2); - pub const PA: Self = GpaPerfBlockAmd(3); - pub const SC: Self = GpaPerfBlockAmd(4); - pub const SPI: Self = GpaPerfBlockAmd(5); - pub const SQ: Self = GpaPerfBlockAmd(6); - pub const SX: Self = GpaPerfBlockAmd(7); - pub const TA: Self = GpaPerfBlockAmd(8); - pub const TD: Self = GpaPerfBlockAmd(9); - pub const TCP: Self = GpaPerfBlockAmd(10); - pub const TCC: Self = GpaPerfBlockAmd(11); - pub const TCA: Self = GpaPerfBlockAmd(12); - pub const DB: Self = GpaPerfBlockAmd(13); - pub const CB: Self = GpaPerfBlockAmd(14); - pub const GDS: Self = GpaPerfBlockAmd(15); - pub const SRBM: Self = GpaPerfBlockAmd(16); - pub const GRBM: Self = GpaPerfBlockAmd(17); - pub const GRBM_SE: Self = GpaPerfBlockAmd(18); - pub const RLC: Self = GpaPerfBlockAmd(19); - pub const DMA: Self = GpaPerfBlockAmd(20); - pub const MC: Self = GpaPerfBlockAmd(21); - pub const CPG: Self = GpaPerfBlockAmd(22); - pub const CPC: Self = GpaPerfBlockAmd(23); - pub const WD: Self = GpaPerfBlockAmd(24); - pub const TCS: Self = GpaPerfBlockAmd(25); - pub const ATC: Self = GpaPerfBlockAmd(26); - pub const ATC_L2: Self = GpaPerfBlockAmd(27); - pub const MC_VM_L2: Self = GpaPerfBlockAmd(28); - pub const EA: Self = GpaPerfBlockAmd(29); - pub const RPB: Self = GpaPerfBlockAmd(30); - pub const RMI: Self = GpaPerfBlockAmd(31); + pub const CPF: Self = Self(0); + pub const IA: Self = Self(1); + pub const VGT: Self = Self(2); + pub const PA: Self = Self(3); + pub const SC: Self = Self(4); + pub const SPI: Self = Self(5); + pub const SQ: Self = Self(6); + pub const SX: Self = Self(7); + pub const TA: Self = Self(8); + pub const TD: Self = Self(9); + pub const TCP: Self = Self(10); + pub const TCC: Self = Self(11); + pub const TCA: Self = Self(12); + pub const DB: Self = Self(13); + pub const CB: Self = Self(14); + pub const GDS: Self = Self(15); + pub const SRBM: Self = Self(16); + pub const GRBM: Self = Self(17); + pub const GRBM_SE: Self = Self(18); + pub const RLC: Self = Self(19); + pub const DMA: Self = Self(20); + pub const MC: Self = Self(21); + pub const CPG: Self = Self(22); + pub const CPC: Self = Self(23); + pub const WD: Self = Self(24); + pub const TCS: Self = Self(25); + pub const ATC: Self = Self(26); + pub const ATC_L2: Self = Self(27); + pub const MC_VM_L2: Self = Self(28); + pub const EA: Self = Self(29); + pub const RPB: Self = Self(30); + pub const RMI: Self = Self(31); } #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] @@ -142,16 +146,16 @@ impl GpaPerfBlockAmd { pub struct GpaSampleTypeAmd(pub(crate) i32); impl GpaSampleTypeAmd { pub fn from_raw(x: i32) -> Self { - GpaSampleTypeAmd(x) + Self(x) } pub fn as_raw(self) -> i32 { self.0 } } impl GpaSampleTypeAmd { - pub const CUMULATIVE: Self = GpaSampleTypeAmd(0); - pub const TRACE: Self = GpaSampleTypeAmd(1); - pub const TIMING: Self = GpaSampleTypeAmd(2); + pub const CUMULATIVE: Self = Self(0); + pub const TRACE: Self = Self(1); + pub const TIMING: Self = Self(2); } handle_nondispatchable!(GpaSessionAmd, UNKNOWN); @@ -200,8 +204,8 @@ pub struct PhysicalDeviceGpaPropertiesAmd { } impl ::std::default::Default for PhysicalDeviceGpaPropertiesAmd { - fn default() -> PhysicalDeviceGpaPropertiesAmd { - PhysicalDeviceGpaPropertiesAmd { + fn default() -> Self { + Self { s_type: StructureType::PHYSICAL_DEVICE_GPA_PROPERTIES_AMD, p_next: ::std::ptr::null_mut(), flags: Flags::default(), @@ -215,7 +219,7 @@ impl ::std::default::Default for PhysicalDeviceGpaPropertiesAmd { impl PhysicalDeviceGpaPropertiesAmd { pub fn builder<'a>() -> PhysicalDeviceGpaPropertiesAmdBuilder<'a> { PhysicalDeviceGpaPropertiesAmdBuilder { - inner: PhysicalDeviceGpaPropertiesAmd::default(), + inner: Self::default(), marker: ::std::marker::PhantomData, } } @@ -365,7 +369,7 @@ unsafe impl Sync for AmdGpaInterfaceFn {} impl ::std::clone::Clone for AmdGpaInterfaceFn { fn clone(&self) -> Self { - AmdGpaInterfaceFn { + Self { create_gpa_session: self.create_gpa_session, destroy_gpa_session: self.destroy_gpa_session, set_gpa_device_clock_mode: self.set_gpa_device_clock_mode, @@ -386,7 +390,7 @@ impl AmdGpaInterfaceFn { where F: FnMut(&::std::ffi::CStr) -> *const c_void, { - AmdGpaInterfaceFn { + Self { create_gpa_session: unsafe { extern "system" fn create_gpa_session_amd( _device: Device, @@ -629,8 +633,8 @@ impl AmdGpaInterfaceFn { // Extension: `VK_AMD_wave_limits` impl StructureType { - pub const WAVE_LIMIT_AMD: Self = StructureType(1000045000); - pub const PHYSICAL_DEVICE_WAVE_LIMIT_PROPERTIES_AMD: Self = StructureType(1000045001); + pub const WAVE_LIMIT_AMD: Self = Self(1000045000); + pub const PHYSICAL_DEVICE_WAVE_LIMIT_PROPERTIES_AMD: Self = Self(1000045001); } #[repr(C)] @@ -643,8 +647,8 @@ pub struct PhysicalDeviceWaveLimitPropertiesAmd { } impl ::std::default::Default for PhysicalDeviceWaveLimitPropertiesAmd { - fn default() -> PhysicalDeviceWaveLimitPropertiesAmd { - PhysicalDeviceWaveLimitPropertiesAmd { + fn default() -> Self { + Self { s_type: StructureType::PHYSICAL_DEVICE_WAVE_LIMIT_PROPERTIES_AMD, p_next: ::std::ptr::null_mut(), cu_count: u32::default(), @@ -655,7 +659,7 @@ impl ::std::default::Default for PhysicalDeviceWaveLimitPropertiesAmd { impl PhysicalDeviceWaveLimitPropertiesAmd { pub fn builder<'a>() -> PhysicalDeviceWaveLimitPropertiesAmdBuilder<'a> { PhysicalDeviceWaveLimitPropertiesAmdBuilder { - inner: PhysicalDeviceWaveLimitPropertiesAmd::default(), + inner: Self::default(), marker: ::std::marker::PhantomData, } } diff --git a/ash/src/extensions/ext/buffer_device_address.rs b/ash/src/extensions/ext/buffer_device_address.rs index 5203b41..a26bc81 100644 --- a/ash/src/extensions/ext/buffer_device_address.rs +++ b/ash/src/extensions/ext/buffer_device_address.rs @@ -11,11 +11,11 @@ pub struct BufferDeviceAddress { } impl BufferDeviceAddress { - pub fn new(instance: &I, device: &D) -> BufferDeviceAddress { + pub fn new(instance: &I, device: &D) -> Self { let fns = vk::ExtBufferDeviceAddressFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - BufferDeviceAddress { + Self { handle: device.handle(), fns, } diff --git a/ash/src/extensions/ext/debug_marker.rs b/ash/src/extensions/ext/debug_marker.rs index 5218d56..19fe5b8 100755 --- a/ash/src/extensions/ext/debug_marker.rs +++ b/ash/src/extensions/ext/debug_marker.rs @@ -11,11 +11,11 @@ pub struct DebugMarker { } impl DebugMarker { - pub fn new(instance: &I, device: &D) -> DebugMarker { + pub fn new(instance: &I, device: &D) -> Self { let debug_marker_fn = vk::ExtDebugMarkerFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - DebugMarker { debug_marker_fn } + Self { debug_marker_fn } } pub fn name() -> &'static CStr { diff --git a/ash/src/extensions/ext/debug_report.rs b/ash/src/extensions/ext/debug_report.rs index 18440f1..675f2d6 100755 --- a/ash/src/extensions/ext/debug_report.rs +++ b/ash/src/extensions/ext/debug_report.rs @@ -13,11 +13,11 @@ pub struct DebugReport { } impl DebugReport { - pub fn new(entry: &E, instance: &I) -> DebugReport { + pub fn new(entry: &E, instance: &I) -> Self { let debug_report_fn = vk::ExtDebugReportFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - DebugReport { + Self { handle: instance.handle(), debug_report_fn, } diff --git a/ash/src/extensions/ext/debug_utils.rs b/ash/src/extensions/ext/debug_utils.rs index b2fadc4..67e13e0 100755 --- a/ash/src/extensions/ext/debug_utils.rs +++ b/ash/src/extensions/ext/debug_utils.rs @@ -12,11 +12,11 @@ pub struct DebugUtils { } impl DebugUtils { - pub fn new(entry: &E, instance: &I) -> DebugUtils { + pub fn new(entry: &E, instance: &I) -> Self { let debug_utils_fn = vk::ExtDebugUtilsFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - DebugUtils { + Self { handle: instance.handle(), debug_utils_fn, } diff --git a/ash/src/extensions/ext/full_screen_exclusive.rs b/ash/src/extensions/ext/full_screen_exclusive.rs index 5195130..264b705 100644 --- a/ash/src/extensions/ext/full_screen_exclusive.rs +++ b/ash/src/extensions/ext/full_screen_exclusive.rs @@ -13,11 +13,11 @@ pub struct FullScreenExclusive { } impl FullScreenExclusive { - pub fn new(instance: &I, device: &D) -> FullScreenExclusive { + pub fn new(instance: &I, device: &D) -> Self { let full_screen_exclusive_fn = vk::ExtFullScreenExclusiveFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - FullScreenExclusive { + Self { handle: device.handle(), full_screen_exclusive_fn, } diff --git a/ash/src/extensions/ext/metal_surface.rs b/ash/src/extensions/ext/metal_surface.rs index eae91a8..df4b09b 100644 --- a/ash/src/extensions/ext/metal_surface.rs +++ b/ash/src/extensions/ext/metal_surface.rs @@ -13,11 +13,11 @@ pub struct MetalSurface { } impl MetalSurface { - pub fn new(entry: &E, instance: &I) -> MetalSurface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::ExtMetalSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - MetalSurface { + Self { handle: instance.handle(), metal_surface_fn: surface_fn, } diff --git a/ash/src/extensions/ext/tooling_info.rs b/ash/src/extensions/ext/tooling_info.rs index fc40533..0323374 100644 --- a/ash/src/extensions/ext/tooling_info.rs +++ b/ash/src/extensions/ext/tooling_info.rs @@ -13,11 +13,11 @@ pub struct ToolingInfo { } impl ToolingInfo { - pub fn new(entry: &E, instance: &I) -> ToolingInfo { + pub fn new(entry: &E, instance: &I) -> Self { let tooling_info_fn = vk::ExtToolingInfoFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - ToolingInfo { + Self { handle: instance.handle(), tooling_info_fn, } diff --git a/ash/src/extensions/khr/android_surface.rs b/ash/src/extensions/khr/android_surface.rs index 606e4ea..80728ab 100755 --- a/ash/src/extensions/khr/android_surface.rs +++ b/ash/src/extensions/khr/android_surface.rs @@ -13,11 +13,11 @@ pub struct AndroidSurface { } impl AndroidSurface { - pub fn new(entry: &E, instance: &I) -> AndroidSurface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::KhrAndroidSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - AndroidSurface { + Self { handle: instance.handle(), android_surface_fn: surface_fn, } diff --git a/ash/src/extensions/khr/buffer_device_address.rs b/ash/src/extensions/khr/buffer_device_address.rs index c6ef4dc..7b2f2bb 100644 --- a/ash/src/extensions/khr/buffer_device_address.rs +++ b/ash/src/extensions/khr/buffer_device_address.rs @@ -11,11 +11,11 @@ pub struct BufferDeviceAddress { } impl BufferDeviceAddress { - pub fn new(instance: &I, device: &D) -> BufferDeviceAddress { + pub fn new(instance: &I, device: &D) -> Self { let fns = vk::KhrBufferDeviceAddressFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - BufferDeviceAddress { + Self { handle: device.handle(), fns, } diff --git a/ash/src/extensions/khr/create_render_pass2.rs b/ash/src/extensions/khr/create_render_pass2.rs index 838a57f..d45dfb8 100644 --- a/ash/src/extensions/khr/create_render_pass2.rs +++ b/ash/src/extensions/khr/create_render_pass2.rs @@ -13,11 +13,11 @@ pub struct CreateRenderPass2 { } impl CreateRenderPass2 { - pub fn new(instance: &I, device: &D) -> CreateRenderPass2 { + pub fn new(instance: &I, device: &D) -> Self { let khr_create_renderpass2_fn = vk::KhrCreateRenderpass2Fn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - CreateRenderPass2 { + Self { handle: device.handle(), khr_create_renderpass2_fn, } diff --git a/ash/src/extensions/khr/display.rs b/ash/src/extensions/khr/display.rs index b40d33e..7569a8c 100755 --- a/ash/src/extensions/khr/display.rs +++ b/ash/src/extensions/khr/display.rs @@ -13,11 +13,11 @@ pub struct Display { } impl Display { - pub fn new(entry: &E, instance: &I) -> Display { + pub fn new(entry: &E, instance: &I) -> Self { let display_fn = vk::KhrDisplayFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - Display { + Self { handle: instance.handle(), display_fn, } diff --git a/ash/src/extensions/khr/display_swapchain.rs b/ash/src/extensions/khr/display_swapchain.rs index a805c85..72a6a65 100755 --- a/ash/src/extensions/khr/display_swapchain.rs +++ b/ash/src/extensions/khr/display_swapchain.rs @@ -13,11 +13,11 @@ pub struct DisplaySwapchain { } impl DisplaySwapchain { - pub fn new(instance: &I, device: &D) -> DisplaySwapchain { + pub fn new(instance: &I, device: &D) -> Self { let swapchain_fn = vk::KhrDisplaySwapchainFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - DisplaySwapchain { + Self { handle: device.handle(), swapchain_fn, } diff --git a/ash/src/extensions/khr/draw_indirect_count.rs b/ash/src/extensions/khr/draw_indirect_count.rs index b911282..84ebb87 100644 --- a/ash/src/extensions/khr/draw_indirect_count.rs +++ b/ash/src/extensions/khr/draw_indirect_count.rs @@ -11,12 +11,11 @@ pub struct DrawIndirectCount { } impl DrawIndirectCount { - pub fn new(instance: &I, device: &D) -> DrawIndirectCount { + pub fn new(instance: &I, device: &D) -> Self { let draw_indirect_count_fn = vk::KhrDrawIndirectCountFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - - DrawIndirectCount { + Self { handle: device.handle(), draw_indirect_count_fn, } diff --git a/ash/src/extensions/khr/get_memory_requirements2.rs b/ash/src/extensions/khr/get_memory_requirements2.rs index 09e5bfb..692a6ab 100644 --- a/ash/src/extensions/khr/get_memory_requirements2.rs +++ b/ash/src/extensions/khr/get_memory_requirements2.rs @@ -12,11 +12,11 @@ pub struct GetMemoryRequirements2 { } impl GetMemoryRequirements2 { - pub fn new(instance: &I, device: &D) -> GetMemoryRequirements2 { + pub fn new(instance: &I, device: &D) -> Self { let get_memory_requirements2_fn = vk::KhrGetMemoryRequirements2Fn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - GetMemoryRequirements2 { + Self { handle: device.handle(), get_memory_requirements2_fn, } diff --git a/ash/src/extensions/khr/get_physical_device_properties2.rs b/ash/src/extensions/khr/get_physical_device_properties2.rs index 2a39254..b3ab220 100644 --- a/ash/src/extensions/khr/get_physical_device_properties2.rs +++ b/ash/src/extensions/khr/get_physical_device_properties2.rs @@ -13,15 +13,12 @@ pub struct GetPhysicalDeviceProperties2 { } impl GetPhysicalDeviceProperties2 { - pub fn new( - entry: &E, - instance: &I, - ) -> GetPhysicalDeviceProperties2 { + pub fn new(entry: &E, instance: &I) -> Self { let get_physical_device_properties2_fn = vk::KhrGetPhysicalDeviceProperties2Fn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - GetPhysicalDeviceProperties2 { + Self { handle: instance.handle(), get_physical_device_properties2_fn, } diff --git a/ash/src/extensions/khr/maintenance1.rs b/ash/src/extensions/khr/maintenance1.rs index 5c1dae1..24e5fa5 100644 --- a/ash/src/extensions/khr/maintenance1.rs +++ b/ash/src/extensions/khr/maintenance1.rs @@ -11,11 +11,11 @@ pub struct Maintenance1 { } impl Maintenance1 { - pub fn new(instance: &I, device: &D) -> Maintenance1 { + pub fn new(instance: &I, device: &D) -> Self { let fns = vk::KhrMaintenance1Fn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - Maintenance1 { + Self { handle: device.handle(), fns, } diff --git a/ash/src/extensions/khr/maintenance3.rs b/ash/src/extensions/khr/maintenance3.rs index 13b4bb5..9ef9b26 100644 --- a/ash/src/extensions/khr/maintenance3.rs +++ b/ash/src/extensions/khr/maintenance3.rs @@ -11,11 +11,11 @@ pub struct Maintenance3 { } impl Maintenance3 { - pub fn new(instance: &I, device: &D) -> Maintenance3 { + pub fn new(instance: &I, device: &D) -> Self { let fns = vk::KhrMaintenance3Fn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - Maintenance3 { + Self { handle: device.handle(), fns, } diff --git a/ash/src/extensions/khr/pipeline_executable_properties.rs b/ash/src/extensions/khr/pipeline_executable_properties.rs index 133c988..485eda1 100644 --- a/ash/src/extensions/khr/pipeline_executable_properties.rs +++ b/ash/src/extensions/khr/pipeline_executable_properties.rs @@ -13,16 +13,12 @@ pub struct PipelineExecutableProperties { } impl PipelineExecutableProperties { - pub fn new( - entry: &E, - instance: &I, - ) -> PipelineExecutableProperties { + pub fn new(entry: &E, instance: &I) -> Self { let pipeline_executable_properties_fn = vk::KhrPipelineExecutablePropertiesFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - - PipelineExecutableProperties { + Self { handle: instance.handle(), pipeline_executable_properties_fn, } diff --git a/ash/src/extensions/khr/push_descriptor.rs b/ash/src/extensions/khr/push_descriptor.rs index 152568e..1daf592 100644 --- a/ash/src/extensions/khr/push_descriptor.rs +++ b/ash/src/extensions/khr/push_descriptor.rs @@ -12,12 +12,11 @@ pub struct PushDescriptor { } impl PushDescriptor { - pub fn new(instance: &I, device: &D) -> PushDescriptor { + pub fn new(instance: &I, device: &D) -> Self { let push_descriptors_fn = vk::KhrPushDescriptorFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - - PushDescriptor { + Self { handle: instance.handle(), push_descriptors_fn, } diff --git a/ash/src/extensions/khr/surface.rs b/ash/src/extensions/khr/surface.rs index 8ea56fb..84c0b5b 100755 --- a/ash/src/extensions/khr/surface.rs +++ b/ash/src/extensions/khr/surface.rs @@ -14,11 +14,11 @@ pub struct Surface { } impl Surface { - pub fn new(entry: &E, instance: &I) -> Surface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::KhrSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - Surface { + Self { handle: instance.handle(), surface_fn, } diff --git a/ash/src/extensions/khr/swapchain.rs b/ash/src/extensions/khr/swapchain.rs index 9a65273..3969f1b 100755 --- a/ash/src/extensions/khr/swapchain.rs +++ b/ash/src/extensions/khr/swapchain.rs @@ -14,11 +14,11 @@ pub struct Swapchain { } impl Swapchain { - pub fn new(instance: &I, device: &D) -> Swapchain { + pub fn new(instance: &I, device: &D) -> Self { let swapchain_fn = vk::KhrSwapchainFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - Swapchain { + Self { handle: device.handle(), swapchain_fn, } diff --git a/ash/src/extensions/khr/timeline_semaphore.rs b/ash/src/extensions/khr/timeline_semaphore.rs index bb34878..e1a7aa7 100644 --- a/ash/src/extensions/khr/timeline_semaphore.rs +++ b/ash/src/extensions/khr/timeline_semaphore.rs @@ -12,12 +12,11 @@ pub struct TimelineSemaphore { } impl TimelineSemaphore { - pub fn new(entry: &E, instance: &I) -> TimelineSemaphore { + pub fn new(entry: &E, instance: &I) -> Self { let timeline_semaphore_fn = vk::KhrTimelineSemaphoreFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - - TimelineSemaphore { + Self { handle: instance.handle(), timeline_semaphore_fn, } diff --git a/ash/src/extensions/khr/wayland_surface.rs b/ash/src/extensions/khr/wayland_surface.rs index 2091928..1b34a6d 100755 --- a/ash/src/extensions/khr/wayland_surface.rs +++ b/ash/src/extensions/khr/wayland_surface.rs @@ -13,11 +13,11 @@ pub struct WaylandSurface { } impl WaylandSurface { - pub fn new(entry: &E, instance: &I) -> WaylandSurface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::KhrWaylandSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - WaylandSurface { + Self { handle: instance.handle(), wayland_surface_fn: surface_fn, } diff --git a/ash/src/extensions/khr/win32_surface.rs b/ash/src/extensions/khr/win32_surface.rs index 3f5f15c..632fa0f 100755 --- a/ash/src/extensions/khr/win32_surface.rs +++ b/ash/src/extensions/khr/win32_surface.rs @@ -13,11 +13,11 @@ pub struct Win32Surface { } impl Win32Surface { - pub fn new(entry: &E, instance: &I) -> Win32Surface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::KhrWin32SurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - Win32Surface { + Self { handle: instance.handle(), win32_surface_fn: surface_fn, } diff --git a/ash/src/extensions/khr/xcb_surface.rs b/ash/src/extensions/khr/xcb_surface.rs index a6b54db..3a433cb 100755 --- a/ash/src/extensions/khr/xcb_surface.rs +++ b/ash/src/extensions/khr/xcb_surface.rs @@ -13,11 +13,11 @@ pub struct XcbSurface { } impl XcbSurface { - pub fn new(entry: &E, instance: &I) -> XcbSurface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::KhrXcbSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - XcbSurface { + Self { handle: instance.handle(), xcb_surface_fn: surface_fn, } diff --git a/ash/src/extensions/khr/xlib_surface.rs b/ash/src/extensions/khr/xlib_surface.rs index 1cebb24..15cbc8c 100755 --- a/ash/src/extensions/khr/xlib_surface.rs +++ b/ash/src/extensions/khr/xlib_surface.rs @@ -13,11 +13,11 @@ pub struct XlibSurface { } impl XlibSurface { - pub fn new(entry: &E, instance: &I) -> XlibSurface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::KhrXlibSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - XlibSurface { + Self { handle: instance.handle(), xlib_surface_fn: surface_fn, } diff --git a/ash/src/extensions/mod.rs b/ash/src/extensions/mod.rs index fefba9b..b5a222c 100644 --- a/ash/src/extensions/mod.rs +++ b/ash/src/extensions/mod.rs @@ -1,3 +1,4 @@ +#![deny(clippy::use_self)] pub mod experimental; pub mod ext; pub mod khr; diff --git a/ash/src/extensions/mvk/ios_surface.rs b/ash/src/extensions/mvk/ios_surface.rs index b3ac4d6..7044bf8 100755 --- a/ash/src/extensions/mvk/ios_surface.rs +++ b/ash/src/extensions/mvk/ios_surface.rs @@ -13,11 +13,11 @@ pub struct IOSSurface { } impl IOSSurface { - pub fn new(entry: &E, instance: &I) -> IOSSurface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::MvkIosSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - IOSSurface { + Self { handle: instance.handle(), ios_surface_fn: surface_fn, } diff --git a/ash/src/extensions/mvk/macos_surface.rs b/ash/src/extensions/mvk/macos_surface.rs index 2d7d664..02a2208 100755 --- a/ash/src/extensions/mvk/macos_surface.rs +++ b/ash/src/extensions/mvk/macos_surface.rs @@ -13,11 +13,11 @@ pub struct MacOSSurface { } impl MacOSSurface { - pub fn new(entry: &E, instance: &I) -> MacOSSurface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::MvkMacosSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - MacOSSurface { + Self { handle: instance.handle(), macos_surface_fn: surface_fn, } diff --git a/ash/src/extensions/nn/vi_surface.rs b/ash/src/extensions/nn/vi_surface.rs index 3d175d6..be3ca10 100644 --- a/ash/src/extensions/nn/vi_surface.rs +++ b/ash/src/extensions/nn/vi_surface.rs @@ -13,11 +13,11 @@ pub struct ViSurface { } impl ViSurface { - pub fn new(entry: &E, instance: &I) -> ViSurface { + pub fn new(entry: &E, instance: &I) -> Self { let surface_fn = vk::NnViSurfaceFn::load(|name| unsafe { mem::transmute(entry.get_instance_proc_addr(instance.handle(), name.as_ptr())) }); - ViSurface { + Self { handle: instance.handle(), vi_surface_fn: surface_fn, } diff --git a/ash/src/extensions/nv/device_diagnostic_checkpoints.rs b/ash/src/extensions/nv/device_diagnostic_checkpoints.rs index 46817ff..6abc2f2 100644 --- a/ash/src/extensions/nv/device_diagnostic_checkpoints.rs +++ b/ash/src/extensions/nv/device_diagnostic_checkpoints.rs @@ -11,15 +11,12 @@ pub struct DeviceDiagnosticCheckpoints { } impl DeviceDiagnosticCheckpoints { - pub fn new( - instance: &I, - device: &D, - ) -> DeviceDiagnosticCheckpoints { + pub fn new(instance: &I, device: &D) -> Self { let device_diagnostic_checkpoints_fn = vk::NvDeviceDiagnosticCheckpointsFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - DeviceDiagnosticCheckpoints { + Self { device_diagnostic_checkpoints_fn, } } diff --git a/ash/src/extensions/nv/mesh_shader.rs b/ash/src/extensions/nv/mesh_shader.rs index 61822b3..a3f838f 100755 --- a/ash/src/extensions/nv/mesh_shader.rs +++ b/ash/src/extensions/nv/mesh_shader.rs @@ -10,12 +10,13 @@ pub struct MeshShader { } impl MeshShader { - pub fn new(instance: &I, device: &D) -> MeshShader { + pub fn new(instance: &I, device: &D) -> Self { let mesh_shader_fn = vk::NvMeshShaderFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - MeshShader { mesh_shader_fn } + Self { mesh_shader_fn } } + #[doc = ""] pub unsafe fn cmd_draw_mesh_tasks( &self, @@ -26,6 +27,7 @@ impl MeshShader { self.mesh_shader_fn .cmd_draw_mesh_tasks_nv(command_buffer, task_count, first_task); } + #[doc = ""] pub unsafe fn cmd_draw_mesh_tasks_indirect( &self, @@ -43,6 +45,7 @@ impl MeshShader { stride, ); } + #[doc = ""] pub unsafe fn cmd_draw_mesh_tasks_indirect_count( &self, @@ -64,6 +67,7 @@ impl MeshShader { stride, ); } + pub fn name() -> &'static CStr { vk::NvMeshShaderFn::name() } diff --git a/ash/src/extensions/nv/ray_tracing.rs b/ash/src/extensions/nv/ray_tracing.rs index cf638a9..7fedc88 100755 --- a/ash/src/extensions/nv/ray_tracing.rs +++ b/ash/src/extensions/nv/ray_tracing.rs @@ -13,11 +13,11 @@ pub struct RayTracing { } impl RayTracing { - pub fn new(instance: &I, device: &D) -> RayTracing { + pub fn new(instance: &I, device: &D) -> Self { let ray_tracing_fn = vk::NvRayTracingFn::load(|name| unsafe { mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) }); - RayTracing { + Self { handle: device.handle(), ray_tracing_fn, }