pci: reevaluate #[allow] attributes

Drop stale #[allow]s whose lints no longer fire and convert the
rest to #[expect], which warns if they ever stop being needed.

Part of #8326.

Signed-off-by: Tushar Khatri <hello@tusharkhatri.in>
This commit is contained in:
Tushar Khatri
2026-06-10 13:50:28 +00:00
committed by Rob Bradford
parent 7042922e83
commit 9eff92fb4b
4 changed files with 4 additions and 13 deletions

View File

@@ -145,7 +145,7 @@ impl PciBus {
}
}
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
pub fn register_mapping(
&self,
dev: Arc<dyn BusDeviceSync>,

View File

@@ -195,7 +195,6 @@ pub trait PciProgrammingInterface {
/// Types of PCI capabilities.
#[derive(PartialEq, Eq, Copy, Clone)]
#[allow(non_camel_case_types)]
#[repr(u8)]
pub enum PciCapabilityId {
ListId = 0,
@@ -532,7 +531,7 @@ pub enum Error {
pub type Result<T> = result::Result<T, Error>;
impl PciConfiguration {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
vendor_id: u16,
device_id: u16,

View File

@@ -615,8 +615,6 @@ impl VfioCommon {
}
}
// The `allocator` argument is unused on `aarch64`
#[allow(unused_variables)]
pub(crate) fn allocate_bars(
&mut self,
allocator: &mut SystemAllocator,
@@ -817,12 +815,9 @@ impl VfioCommon {
bar_id += 1;
}
}
Ok(bars)
}
// The `allocator` argument is unused on `aarch64`
#[allow(unused_variables)]
pub(crate) fn free_bars(
&mut self,
allocator: &mut SystemAllocator,
@@ -1493,7 +1488,7 @@ pub struct VfioPciDevice {
impl VfioPciDevice {
/// Constructs a new Vfio Pci device for the given Vfio device
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
id: String,
vm: Arc<dyn hypervisor::Vm>,
@@ -1790,7 +1785,6 @@ impl VfioPciDevice {
// Only needed if p2p_dma is enabled.
if !self.iommu_attached && self.p2p_dma {
// vfio_dma_map should be unsafe but isn't.
#[allow(unused_unsafe)]
// SAFETY: MmapRegion invariants guarantee that
// user_memory_region.mapping.addr() points to
// user_memory_region.mapping.len() bytes of
@@ -2037,7 +2031,6 @@ iova 0x{:x}, size 0x{:x}: {}, ",
// Only needed if p2p_dma is enabled.
if !self.iommu_attached && self.p2p_dma {
// vfio_dma_map is unsound and ought to be marked as unsafe
#[allow(unused_unsafe)]
// SAFETY: MmapRegion invariants guarantee that
// host_addr points to len bytes of
// valid memory that will only be unmapped with munmap().
@@ -2158,7 +2151,6 @@ impl<M: GuestAddressSpace + Sync + Send> ExternalDmaMapping for VfioDmaMapping<M
};
// vfio_dma_map is unsound and ought to be marked as unsafe
#[allow(unused_unsafe)]
// SAFETY: find_user_address and GuestMemory::get_slice() guarantee that
// the returned pointer is valid for up to `usize_size` bytes.
// `usize_size` is always equal to `size` due to the above `try_into()` call.

View File

@@ -73,7 +73,7 @@ impl PciSubclass for PciVfioUserSubclass {
}
impl VfioUserPciDevice {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
id: String,
vm: Arc<dyn hypervisor::Vm>,