From 76ddaf55385c6e551b6234ad48f073b75981cb4a Mon Sep 17 00:00:00 2001 From: Matthew Jackson <1085847+MattJackson@users.noreply.github.com> Date: Tue, 6 Oct 2026 16:53:57 -0700 Subject: [PATCH] style: no new #[allow] for the Windows enumeration helpers Name STORAGE_DEVICE_NUMBER's fields in snake_case (repr(C) layout is unchanged) and compile the 36-byte INQUIRY retry only on Windows, which keeps lint_stop's #[allow] baseline. --- src/scsi/mod.rs | 2 +- src/scsi/windows.rs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/scsi/mod.rs b/src/scsi/mod.rs index 34b7382b..83fadedc 100644 --- a/src/scsi/mod.rs +++ b/src/scsi/mod.rs @@ -548,7 +548,7 @@ pub fn inquiry(scsi: &mut dyn ScsiTransport) -> Result { } /// INQUIRY with the standard 36-byte allocation, for bridges that reject longer ones. -#[cfg_attr(not(windows), allow(dead_code))] +#[cfg(windows)] pub(crate) fn inquiry_standard(scsi: &mut dyn ScsiTransport) -> Result { inquiry_alloc(scsi, INQUIRY_MIN_LEN) } diff --git a/src/scsi/windows.rs b/src/scsi/windows.rs index bb8cc94a..fca7863d 100644 --- a/src/scsi/windows.rs +++ b/src/scsi/windows.rs @@ -108,13 +108,12 @@ struct StorageAdapterDescriptor { BusMinorVersion: u16, } -/// `STORAGE_DEVICE_NUMBER` (winioctl.h). +/// `STORAGE_DEVICE_NUMBER` (winioctl.h): DeviceType, DeviceNumber, PartitionNumber. #[repr(C)] -#[allow(non_snake_case)] struct StorageDeviceNumber { - DeviceType: u32, - DeviceNumber: u32, - PartitionNumber: u32, + device_type: u32, + device_number: u32, + _partition_number: u32, } // ── Windows FFI ──────────────────────────────────────────────────────────── @@ -368,7 +367,7 @@ fn device_number(path: &str) -> Option { ) }; unsafe { CloseHandle(handle) }; - (ok != 0 && number.DeviceType == FILE_DEVICE_CD_ROM).then_some(number.DeviceNumber) + (ok != 0 && number.device_type == FILE_DEVICE_CD_ROM).then_some(number.device_number) } /// TEST UNIT READY probe on Windows. No in-library recovery: the answer is