Skip to content

Commit 69730b7

Browse files
authored
Fix all new clippy lints since Rust 1.88 (#279)
1 parent 1ad50b6 commit 69730b7

File tree

9 files changed

+25
-33
lines changed

9 files changed

+25
-33
lines changed

.cargo/config.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ rustflags = [
3939
"-Wclippy::map_err_ignore",
4040
"-Wclippy::map_flatten",
4141
"-Wclippy::map_unwrap_or",
42-
"-Wclippy::match_on_vec_items",
4342
"-Wclippy::match_same_arms",
4443
"-Wclippy::match_wild_err_arm",
4544
"-Wclippy::match_wildcard_for_single_variants",

examples/d3d12-buffer-winrs.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option<ID3D12Device> {
3333
let adapter1 = match unsafe { dxgi_factory.EnumAdapters1(idx) } {
3434
Ok(a) => a,
3535
Err(e) if e.code() == DXGI_ERROR_NOT_FOUND => break,
36-
Err(e) => panic!("{:?}", e),
36+
Err(e) => panic!("{e:?}"),
3737
};
3838
let adapter4: IDXGIAdapter4 = adapter1.cast().unwrap();
3939

@@ -58,18 +58,15 @@ fn create_d3d12_device(dxgi_factory: &IDXGIFactory6) -> Option<ID3D12Device> {
5858
let mut device = None;
5959
match unsafe { D3D12CreateDevice(&adapter4, feature_level, &mut device) } {
6060
Ok(()) => {
61-
info!("Using D3D12 feature level: {}", feature_level_name);
61+
info!("Using D3D12 feature level: {feature_level_name}");
6262
Some(device.unwrap())
6363
}
6464
Err(e) if e.code() == E_NOINTERFACE => {
6565
error!("ID3D12Device interface not supported");
6666
None
6767
}
6868
Err(e) => {
69-
info!(
70-
"D3D12 feature level {} not supported: {}",
71-
feature_level_name, e
72-
);
69+
info!("D3D12 feature level {feature_level_name} not supported: {e}");
7370
None
7471
}
7572
}

src/d3d12/mod.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ impl MemoryBlock {
288288
match hr {
289289
Err(e) if e.code() == E_OUTOFMEMORY => Err(AllocationError::OutOfMemory),
290290
Err(e) => Err(AllocationError::Internal(format!(
291-
"ID3D12Device::CreateHeap failed: {}",
292-
e
291+
"ID3D12Device::CreateHeap failed: {e}"
293292
))),
294293
Ok(()) => heap.ok_or_else(|| {
295294
AllocationError::Internal(
@@ -523,7 +522,7 @@ impl Allocator {
523522
)
524523
}
525524
.map_err(|e| {
526-
AllocationError::Internal(format!("ID3D12Device::CheckFeatureSupport failed: {}", e))
525+
AllocationError::Internal(format!("ID3D12Device::CheckFeatureSupport failed: {e}"))
527526
})?;
528527

529528
let is_heap_tier1 = options.ResourceHeapTier == D3D12_RESOURCE_HEAP_TIER_1;
@@ -629,7 +628,7 @@ impl Allocator {
629628
);
630629
if self.debug_settings.log_stack_traces {
631630
let backtrace = Backtrace::force_capture();
632-
debug!("Allocation stack trace: {}", backtrace);
631+
debug!("Allocation stack trace: {backtrace}");
633632
}
634633
}
635634

@@ -658,10 +657,10 @@ impl Allocator {
658657
pub fn free(&mut self, allocation: Allocation) -> Result<()> {
659658
if self.debug_settings.log_frees {
660659
let name = allocation.name.as_deref().unwrap_or("<null>");
661-
debug!("Freeing `{}`.", name);
660+
debug!("Freeing `{name}`.");
662661
if self.debug_settings.log_stack_traces {
663662
let backtrace = Backtrace::force_capture();
664-
debug!("Free stack trace: {}", backtrace);
663+
debug!("Free stack trace: {backtrace}");
665664
}
666665
}
667666

@@ -845,8 +844,7 @@ impl Allocator {
845844
)));
846845
}
847846
return Err(AllocationError::Internal(format!(
848-
"ID3D12Device::CreateCommittedResource failed: {}",
849-
e
847+
"ID3D12Device::CreateCommittedResource failed: {e}"
850848
)));
851849
}
852850

@@ -961,8 +959,7 @@ impl Allocator {
961959
)));
962960
}
963961
return Err(AllocationError::Internal(format!(
964-
"ID3D12Device::CreatePlacedResource failed: {}",
965-
e
962+
"ID3D12Device::CreatePlacedResource failed: {e}"
966963
)));
967964
}
968965

src/d3d12/visualizer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ impl AllocatorVisualizer {
128128
"total committed resource allocations: {} KiB",
129129
mem_type.committed_allocations.total_size
130130
));
131-
ui.label(format!("block count: {}", active_block_count));
131+
ui.label(format!("block count: {active_block_count}"));
132132

133133
for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() {
134134
let Some(block) = block else { continue };
135135

136-
ui.collapsing(format!("Block: {}", block_idx), |ui| {
136+
ui.collapsing(format!("Block: {block_idx}"), |ui| {
137137
ui.label(format!("size: {} KiB", block.size / 1024));
138138
ui.label(format!(
139139
"allocated: {} KiB",

src/metal/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl Allocator {
495495
);
496496
if self.debug_settings.log_stack_traces {
497497
let backtrace = Backtrace::force_capture();
498-
debug!("Allocation stack trace: {}", backtrace);
498+
debug!("Allocation stack trace: {backtrace}");
499499
}
500500
}
501501

@@ -520,10 +520,10 @@ impl Allocator {
520520
pub fn free(&mut self, allocation: &Allocation) -> Result<()> {
521521
if self.debug_settings.log_frees {
522522
let name = allocation.name.as_deref().unwrap_or("<null>");
523-
debug!("Freeing `{}`.", name);
523+
debug!("Freeing `{name}`.");
524524
if self.debug_settings.log_stack_traces {
525525
let backtrace = Backtrace::force_capture();
526-
debug!("Free stack trace: {}", backtrace);
526+
debug!("Free stack trace: {backtrace}");
527527
}
528528
}
529529

src/metal/visualizer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ impl AllocatorVisualizer {
7070
ui.label(format!("memory type index: {}", mem_type.memory_type_index));
7171
ui.label(format!("total block size: {} KiB", total_block_size / 1024));
7272
ui.label(format!("total allocated: {} KiB", total_allocated / 1024));
73-
ui.label(format!("block count: {}", active_block_count));
73+
ui.label(format!("block count: {active_block_count}"));
7474

7575
for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() {
7676
let Some(block) = block else { continue };
7777

78-
ui.collapsing(format!("Block: {}", block_idx), |ui| {
78+
ui.collapsing(format!("Block: {block_idx}"), |ui| {
7979
ui.label(format!("size: {} KiB", block.size / 1024));
8080
ui.label(format!(
8181
"allocated: {} KiB",

src/visualizer/memory_chunks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub(crate) fn render_memory_chunks_ui<'a>(
111111
chunk.allocation_type.as_str()
112112
));
113113
if let Some(name) = &chunk.name {
114-
ui.label(format!("name: {}", name));
114+
ui.label(format!("name: {name}"));
115115
}
116116
if settings.show_backtraces
117117
&& chunk.backtrace.status() == BacktraceStatus::Captured

src/vulkan/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,7 @@ impl MemoryBlock {
386386
unsafe { device.allocate_memory(&alloc_info, None) }.map_err(|e| match e {
387387
vk::Result::ERROR_OUT_OF_DEVICE_MEMORY => AllocationError::OutOfMemory,
388388
e => AllocationError::Internal(format!(
389-
"Unexpected error in vkAllocateMemory: {:?}",
390-
e
389+
"Unexpected error in vkAllocateMemory: {e:?}"
391390
)),
392391
})?
393392
};
@@ -783,7 +782,7 @@ impl Allocator {
783782
);
784783
if self.debug_settings.log_stack_traces {
785784
let backtrace = Backtrace::force_capture();
786-
debug!("Allocation stack trace: {}", backtrace);
785+
debug!("Allocation stack trace: {backtrace}");
787786
}
788787
}
789788

@@ -871,10 +870,10 @@ impl Allocator {
871870
pub fn free(&mut self, allocation: Allocation) -> Result<()> {
872871
if self.debug_settings.log_frees {
873872
let name = allocation.name.as_deref().unwrap_or("<null>");
874-
debug!("Freeing `{}`.", name);
873+
debug!("Freeing `{name}`.");
875874
if self.debug_settings.log_stack_traces {
876875
let backtrace = Backtrace::force_capture();
877-
debug!("Free stack trace: {}", backtrace);
876+
debug!("Free stack trace: {backtrace}");
878877
}
879878
}
880879

src/vulkan/visualizer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl AllocatorVisualizer {
5050
format!("Memory Heaps ({} heaps)", alloc.memory_heaps.len()),
5151
|ui| {
5252
for (i, heap) in alloc.memory_heaps.iter().enumerate() {
53-
ui.collapsing(format!("Heap: {}", i), |ui| {
53+
ui.collapsing(format!("Heap: {i}"), |ui| {
5454
ui.label(format!("flags: {:?}", heap.flags));
5555
ui.label(format!(
5656
"size: {} MiB",
@@ -90,12 +90,12 @@ impl AllocatorVisualizer {
9090
ui.label(format!("heap index: {}", mem_type.heap_index));
9191
ui.label(format!("total block size: {} KiB", total_block_size / 1024));
9292
ui.label(format!("total allocated: {} KiB", total_allocated / 1024));
93-
ui.label(format!("block count: {}", active_block_count));
93+
ui.label(format!("block count: {active_block_count}"));
9494

9595
for (block_idx, block) in mem_type.memory_blocks.iter().enumerate() {
9696
let Some(block) = block else { continue };
9797

98-
ui.collapsing(format!("Block: {}", block_idx), |ui| {
98+
ui.collapsing(format!("Block: {block_idx}"), |ui| {
9999
use ash::vk::Handle;
100100

101101
ui.label(format!("size: {} KiB", block.size / 1024));

0 commit comments

Comments
 (0)