diff --git a/.cargo/config.toml b/.cargo/config.toml index f998061d..a0c7d9d7 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -39,7 +39,6 @@ rustflags = [ "-Wclippy::map_err_ignore", "-Wclippy::map_flatten", "-Wclippy::map_unwrap_or", - "-Wclippy::match_on_vec_items", "-Wclippy::match_same_arms", "-Wclippy::match_wild_err_arm", "-Wclippy::match_wildcard_for_single_variants", diff --git a/examples/d3d12-buffer-winrs.rs b/examples/d3d12-buffer-winrs.rs index e088de9b..b5f5354c 100644 --- a/examples/d3d12-buffer-winrs.rs +++ b/examples/d3d12-buffer-winrs.rs @@ -33,7 +33,7 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option { let adapter1 = match unsafe { dxgi_factory.EnumAdapters1(idx) } { Ok(a) => a, Err(e) if e.code() == DXGI_ERROR_NOT_FOUND => break, - Err(e) => panic!("{:?}", e), + Err(e) => panic!("{e:?}"), }; let adapter4: IDXGIAdapter4 = adapter1.cast().unwrap(); @@ -58,7 +58,7 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option { let mut device = None; match unsafe { D3D12CreateDevice(&adapter4, feature_level, &mut device) } { Ok(()) => { - info!("Using D3D12 feature level: {}", feature_level_name); + info!("Using D3D12 feature level: {feature_level_name}"); Some(device.unwrap()) } Err(e) if e.code() == E_NOINTERFACE => { @@ -66,10 +66,7 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option { None } Err(e) => { - info!( - "D3D12 feature level {} not supported: {}", - feature_level_name, e - ); + info!("D3D12 feature level {feature_level_name} not supported: {e}"); None } } diff --git a/src/d3d12/mod.rs b/src/d3d12/mod.rs index c494e8d0..294e85e0 100644 --- a/src/d3d12/mod.rs +++ b/src/d3d12/mod.rs @@ -288,8 +288,7 @@ impl MemoryBlock { match hr { Err(e) if e.code() == E_OUTOFMEMORY => Err(AllocationError::OutOfMemory), Err(e) => Err(AllocationError::Internal(format!( - "ID3D12Device::CreateHeap failed: {}", - e + "ID3D12Device::CreateHeap failed: {e}" ))), Ok(()) => heap.ok_or_else(|| { AllocationError::Internal( @@ -523,7 +522,7 @@ impl Allocator { ) } .map_err(|e| { - AllocationError::Internal(format!("ID3D12Device::CheckFeatureSupport failed: {}", e)) + AllocationError::Internal(format!("ID3D12Device::CheckFeatureSupport failed: {e}")) })?; let is_heap_tier1 = options.ResourceHeapTier == D3D12_RESOURCE_HEAP_TIER_1; @@ -629,7 +628,7 @@ impl Allocator { ); if self.debug_settings.log_stack_traces { let backtrace = Backtrace::force_capture(); - debug!("Allocation stack trace: {}", backtrace); + debug!("Allocation stack trace: {backtrace}"); } } @@ -658,10 +657,10 @@ impl Allocator { pub fn free(&mut self, allocation: Allocation) -> Result<()> { if self.debug_settings.log_frees { let name = allocation.name.as_deref().unwrap_or(""); - debug!("Freeing `{}`.", name); + debug!("Freeing `{name}`."); if self.debug_settings.log_stack_traces { let backtrace = Backtrace::force_capture(); - debug!("Free stack trace: {}", backtrace); + debug!("Free stack trace: {backtrace}"); } } @@ -845,8 +844,7 @@ impl Allocator { ))); } return Err(AllocationError::Internal(format!( - "ID3D12Device::CreateCommittedResource failed: {}", - e + "ID3D12Device::CreateCommittedResource failed: {e}" ))); } @@ -961,8 +959,7 @@ impl Allocator { ))); } return Err(AllocationError::Internal(format!( - "ID3D12Device::CreatePlacedResource failed: {}", - e + "ID3D12Device::CreatePlacedResource failed: {e}" ))); } diff --git a/src/d3d12/visualizer.rs b/src/d3d12/visualizer.rs index adcc9d40..c1cd37a2 100644 --- a/src/d3d12/visualizer.rs +++ b/src/d3d12/visualizer.rs @@ -128,12 +128,12 @@ impl AllocatorVisualizer { "total committed resource allocations: {} KiB", mem_type.committed_allocations.total_size )); - ui.label(format!("block count: {}", active_block_count)); + ui.label(format!("block count: {active_block_count}")); for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() { let Some(block) = block else { continue }; - ui.collapsing(format!("Block: {}", block_idx), |ui| { + ui.collapsing(format!("Block: {block_idx}"), |ui| { ui.label(format!("size: {} KiB", block.size / 1024)); ui.label(format!( "allocated: {} KiB", diff --git a/src/metal/mod.rs b/src/metal/mod.rs index dbaed1c7..45c120cb 100644 --- a/src/metal/mod.rs +++ b/src/metal/mod.rs @@ -495,7 +495,7 @@ impl Allocator { ); if self.debug_settings.log_stack_traces { let backtrace = Backtrace::force_capture(); - debug!("Allocation stack trace: {}", backtrace); + debug!("Allocation stack trace: {backtrace}"); } } @@ -520,10 +520,10 @@ impl Allocator { pub fn free(&mut self, allocation: &Allocation) -> Result<()> { if self.debug_settings.log_frees { let name = allocation.name.as_deref().unwrap_or(""); - debug!("Freeing `{}`.", name); + debug!("Freeing `{name}`."); if self.debug_settings.log_stack_traces { let backtrace = Backtrace::force_capture(); - debug!("Free stack trace: {}", backtrace); + debug!("Free stack trace: {backtrace}"); } } diff --git a/src/metal/visualizer.rs b/src/metal/visualizer.rs index 8f4f50f4..26b3c135 100644 --- a/src/metal/visualizer.rs +++ b/src/metal/visualizer.rs @@ -70,12 +70,12 @@ impl AllocatorVisualizer { ui.label(format!("memory type index: {}", mem_type.memory_type_index)); ui.label(format!("total block size: {} KiB", total_block_size / 1024)); ui.label(format!("total allocated: {} KiB", total_allocated / 1024)); - ui.label(format!("block count: {}", active_block_count)); + ui.label(format!("block count: {active_block_count}")); for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() { let Some(block) = block else { continue }; - ui.collapsing(format!("Block: {}", block_idx), |ui| { + ui.collapsing(format!("Block: {block_idx}"), |ui| { ui.label(format!("size: {} KiB", block.size / 1024)); ui.label(format!( "allocated: {} KiB", diff --git a/src/visualizer/memory_chunks.rs b/src/visualizer/memory_chunks.rs index 66156000..75ad3d78 100644 --- a/src/visualizer/memory_chunks.rs +++ b/src/visualizer/memory_chunks.rs @@ -111,7 +111,7 @@ pub(crate) fn render_memory_chunks_ui<'a>( chunk.allocation_type.as_str() )); if let Some(name) = &chunk.name { - ui.label(format!("name: {}", name)); + ui.label(format!("name: {name}")); } if settings.show_backtraces && chunk.backtrace.status() == BacktraceStatus::Captured diff --git a/src/vulkan/mod.rs b/src/vulkan/mod.rs index e2717098..d57a9152 100644 --- a/src/vulkan/mod.rs +++ b/src/vulkan/mod.rs @@ -386,8 +386,7 @@ impl MemoryBlock { unsafe { device.allocate_memory(&alloc_info, None) }.map_err(|e| match e { vk::Result::ERROR_OUT_OF_DEVICE_MEMORY => AllocationError::OutOfMemory, e => AllocationError::Internal(format!( - "Unexpected error in vkAllocateMemory: {:?}", - e + "Unexpected error in vkAllocateMemory: {e:?}" )), })? }; @@ -783,7 +782,7 @@ impl Allocator { ); if self.debug_settings.log_stack_traces { let backtrace = Backtrace::force_capture(); - debug!("Allocation stack trace: {}", backtrace); + debug!("Allocation stack trace: {backtrace}"); } } @@ -871,10 +870,10 @@ impl Allocator { pub fn free(&mut self, allocation: Allocation) -> Result<()> { if self.debug_settings.log_frees { let name = allocation.name.as_deref().unwrap_or(""); - debug!("Freeing `{}`.", name); + debug!("Freeing `{name}`."); if self.debug_settings.log_stack_traces { let backtrace = Backtrace::force_capture(); - debug!("Free stack trace: {}", backtrace); + debug!("Free stack trace: {backtrace}"); } } diff --git a/src/vulkan/visualizer.rs b/src/vulkan/visualizer.rs index ab400db5..ed4cbad4 100644 --- a/src/vulkan/visualizer.rs +++ b/src/vulkan/visualizer.rs @@ -50,7 +50,7 @@ impl AllocatorVisualizer { format!("Memory Heaps ({} heaps)", alloc.memory_heaps.len()), |ui| { for (i, heap) in alloc.memory_heaps.iter().enumerate() { - ui.collapsing(format!("Heap: {}", i), |ui| { + ui.collapsing(format!("Heap: {i}"), |ui| { ui.label(format!("flags: {:?}", heap.flags)); ui.label(format!( "size: {} MiB", @@ -90,12 +90,12 @@ impl AllocatorVisualizer { ui.label(format!("heap index: {}", mem_type.heap_index)); ui.label(format!("total block size: {} KiB", total_block_size / 1024)); ui.label(format!("total allocated: {} KiB", total_allocated / 1024)); - ui.label(format!("block count: {}", active_block_count)); + ui.label(format!("block count: {active_block_count}")); for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() { let Some(block) = block else { continue }; - ui.collapsing(format!("Block: {}", block_idx), |ui| { + ui.collapsing(format!("Block: {block_idx}"), |ui| { use ash::vk::Handle; ui.label(format!("size: {} KiB", block.size / 1024));