Skip to content

Commit

Permalink
Work around unused_qualifications lint for Rust 1.80 prelude extension
Browse files Browse the repository at this point in the history
`size_of(_val)()` was added to the prelude in Rust 1.80, causing
`unused_qualifications` warnings whenever we qualify a call to it with
via `std::mem::size_of_val()`.

The easiest workaround is to remove the prefix and explicitly import the
function in scope.  We annotate the import with a `TODO` to remove it
once bumping our MSRV on or past 1.80.
  • Loading branch information
MarijnS95 committed Oct 3, 2024
1 parent a0badca commit be8b03e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/d3d12/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
use std::{backtrace::Backtrace, fmt, sync::Arc};
use std::{
backtrace::Backtrace,
fmt,
// TODO: Remove when bumping MSRV to 1.80
mem::size_of_val,
sync::Arc,
};

use log::{debug, warn, Level};
use windows::Win32::{
Expand Down Expand Up @@ -628,7 +634,7 @@ impl Allocator {
device.CheckFeatureSupport(
D3D12_FEATURE_D3D12_OPTIONS,
<*mut D3D12_FEATURE_DATA_D3D12_OPTIONS>::cast(&mut options),
std::mem::size_of_val(&options) as u32,
size_of_val(&options) as u32,
)
}
.map_err(|e| {
Expand Down

0 comments on commit be8b03e

Please sign in to comment.