From 00aa5a5daca6564243eac481afca46080641b50c Mon Sep 17 00:00:00 2001 From: Aryan Behmardi Date: Wed, 10 Dec 2025 23:33:13 +0000 Subject: [PATCH] fix: enable clippy as_conversions lint across workspace Signed-off-by: Aryan Behmardi --- Cargo.toml | 5 +- src/acpi-tables/src/aml.rs | 104 +++++++++++++----- src/acpi-tables/src/dsdt.rs | 4 +- src/acpi-tables/src/madt.rs | 2 +- src/acpi-tables/src/xsdt.rs | 2 +- src/cpu-template-helper/build.rs | 2 +- src/cpu-template-helper/src/utils/mod.rs | 2 + .../examples/uffd/fault_all_handler.rs | 2 + src/firecracker/examples/uffd/uffd_utils.rs | 1 + src/firecracker/src/main.rs | 2 + src/jailer/src/resource_limits.rs | 10 +- src/rebase-snap/src/main.rs | 3 +- src/seccompiler/src/bindings.rs | 6 +- src/seccompiler/src/lib.rs | 4 +- src/seccompiler/src/types.rs | 16 +-- src/snapshot-editor/src/edit_memory.rs | 2 + src/utils/src/time.rs | 2 +- src/vmm/benches/queue.rs | 2 +- src/vmm/src/lib.rs | 1 + src/vmm/tests/devices.rs | 3 +- src/vmm/tests/io_uring.rs | 6 +- 21 files changed, 122 insertions(+), 59 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a1c9ad79621..68e432a42d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,11 +20,8 @@ missing_debug_implementations = "warn" unexpected_cfgs = { level = "warn", check-cfg = ['cfg(kani)'] } [workspace.lints.clippy] -ptr_as_ptr = "warn" +as_conversions = "warn" undocumented_unsafe_blocks = "warn" -cast_possible_truncation = "warn" -cast_possible_wrap = "warn" -cast_sign_loss = "warn" exit = "warn" tests_outside_test_module = "warn" assertions_on_result_states = "warn" diff --git a/src/acpi-tables/src/aml.rs b/src/acpi-tables/src/aml.rs index 5c7e91a2d6a..23909be1a84 100644 --- a/src/acpi-tables/src/aml.rs +++ b/src/acpi-tables/src/aml.rs @@ -296,7 +296,7 @@ impl Aml for Usize { TryInto::::try_into(*self) .unwrap() .append_aml_bytes(bytes) - } else if *self <= u32::MAX as usize { + } else if *self <= u32::MAX.try_into().unwrap_or(usize::MAX) { TryInto::::try_into(*self) .unwrap() .append_aml_bytes(bytes) @@ -407,6 +407,16 @@ enum AddressSpaceType { BusNumber, } +impl From for u8 { + fn from(val: AddressSpaceType) -> u8 { + match val { + AddressSpaceType::Memory => 0, + AddressSpaceType::Io => 1, + AddressSpaceType::BusNumber => 2, + } + } +} + #[derive(Copy, Clone)] pub enum AddressSpaceCacheable { NotCacheable, @@ -415,6 +425,17 @@ pub enum AddressSpaceCacheable { PreFetchable, } +impl From for u8 { + fn from(val: AddressSpaceCacheable) -> u8 { + match val { + AddressSpaceCacheable::NotCacheable => 0, + AddressSpaceCacheable::Cacheable => 1, + AddressSpaceCacheable::WriteCombining => 2, + AddressSpaceCacheable::PreFetchable => 3, + } + } +} + pub struct AddressSpace { r#type: AddressSpaceType, min: T, @@ -439,7 +460,7 @@ where r#type: AddressSpaceType::Memory, min, max, - type_flags: ((cacheable as u8) << 1) | u8::from(read_write), + type_flags: ((u8::from(cacheable)) << 1) | u8::from(read_write), }) } @@ -470,7 +491,7 @@ where fn push_header(&self, bytes: &mut Vec, descriptor: u8, length: usize) { bytes.push(descriptor); // Word Address Space Descriptor bytes.extend_from_slice(&(TryInto::::try_into(length).unwrap()).to_le_bytes()); - bytes.push(self.r#type as u8); // type + bytes.push(u8::from(self.r#type)); // type let generic_flags = (1 << 2) /* Min Fixed */ | (1 << 3); // Max Fixed bytes.push(generic_flags); bytes.push(self.type_flags); @@ -725,6 +746,19 @@ pub enum FieldAccessType { Buffer, } +impl From for u8 { + fn from(val: FieldAccessType) -> u8 { + match val { + FieldAccessType::Any => 0, + FieldAccessType::Byte => 1, + FieldAccessType::Word => 2, + FieldAccessType::DWord => 3, + FieldAccessType::QWord => 4, + FieldAccessType::Buffer => 5, + } + } +} + #[derive(Clone, Copy)] pub enum FieldUpdateRule { Preserve = 0, @@ -732,6 +766,15 @@ pub enum FieldUpdateRule { WriteAsZeroes = 2, } +impl From for u8 { + fn from(val: FieldUpdateRule) -> u8 { + #[allow(clippy::as_conversions)] + { + val as u8 + } + } +} + pub enum FieldEntry { Named([u8; 4], usize), Reserved(usize), @@ -766,7 +809,7 @@ impl Aml for Field { let mut tmp = Vec::new(); self.path.append_aml_bytes(&mut tmp)?; - let flags: u8 = self.access_type as u8 | ((self.update_rule as u8) << 5); + let flags: u8 = u8::from(self.access_type) | ((u8::from(self.update_rule)) << 5); tmp.push(flags); for field in self.fields.iter() { @@ -806,6 +849,23 @@ pub enum OpRegionSpace { GenericSerialBus, } +impl From for u8 { + fn from(val: OpRegionSpace) -> u8 { + match val { + OpRegionSpace::SystemMemory => 0, + OpRegionSpace::SystemIo => 1, + OpRegionSpace::PConfig => 2, + OpRegionSpace::EmbeddedControl => 3, + OpRegionSpace::Smbus => 4, + OpRegionSpace::SystemCmos => 5, + OpRegionSpace::PciBarTarget => 6, + OpRegionSpace::Ipmi => 7, + OpRegionSpace::GeneralPurposeIo => 8, + OpRegionSpace::GenericSerialBus => 9, + } + } +} + pub struct OpRegion { path: Path, space: OpRegionSpace, @@ -829,7 +889,7 @@ impl Aml for OpRegion { bytes.push(0x5b); // ExtOpPrefix bytes.push(0x80); // OpRegionOp self.path.append_aml_bytes(bytes)?; - bytes.push(self.space as u8); + bytes.push(u8::from(self.space)); self.offset.append_aml_bytes(bytes)?; // RegionOffset self.length.append_aml_bytes(bytes)?; // RegionLen Ok(()) @@ -1500,7 +1560,7 @@ mod tests { assert_eq!( create_pkg_length(&[0u8; 4096], true), vec![ - (2 << 6) | (4099 & 0xf) as u8, + u8::try_from((2 << 6) | (4099 & 0xf)).unwrap(), ((4099 >> 4) & 0xff).try_into().unwrap(), ((4099 >> 12) & 0xff).try_into().unwrap() ] @@ -1535,28 +1595,18 @@ mod tests { } #[test] fn test_name_path() { + let path: &Path = &"_SB_".try_into().unwrap(); + assert_eq!(path.to_aml_bytes().unwrap(), [0x5Fu8, 0x53, 0x42, 0x5F]); + let path: &Path = &"\\_SB_".try_into().unwrap(); + assert_eq!(path.to_aml_bytes().unwrap(), [0x5C, 0x5F, 0x53, 0x42, 0x5F]); + let path: &Path = &"_SB_.COM1".try_into().unwrap(); assert_eq!( - (&"_SB_".try_into().unwrap() as &Path) - .to_aml_bytes() - .unwrap(), - [0x5Fu8, 0x53, 0x42, 0x5F] - ); - assert_eq!( - (&"\\_SB_".try_into().unwrap() as &Path) - .to_aml_bytes() - .unwrap(), - [0x5C, 0x5F, 0x53, 0x42, 0x5F] - ); - assert_eq!( - (&"_SB_.COM1".try_into().unwrap() as &Path) - .to_aml_bytes() - .unwrap(), + path.to_aml_bytes().unwrap(), [0x2E, 0x5F, 0x53, 0x42, 0x5F, 0x43, 0x4F, 0x4D, 0x31] ); + let path: &Path = &"_SB_.PCI0._HID".try_into().unwrap(); assert_eq!( - (&"_SB_.PCI0._HID".try_into().unwrap() as &Path) - .to_aml_bytes() - .unwrap(), + path.to_aml_bytes().unwrap(), [ 0x2F, 0x03, 0x5F, 0x53, 0x42, 0x5F, 0x50, 0x43, 0x49, 0x30, 0x5F, 0x48, 0x49, 0x44 ] @@ -1599,10 +1649,8 @@ mod tests { #[test] fn test_string() { - assert_eq!( - (&"ACPI" as &dyn Aml).to_aml_bytes().unwrap(), - [0x0d, b'A', b'C', b'P', b'I', 0] - ); + let s: &dyn Aml = &"ACPI"; + assert_eq!(s.to_aml_bytes().unwrap(), [0x0d, b'A', b'C', b'P', b'I', 0]); assert_eq!( "ACPI".to_owned().to_aml_bytes().unwrap(), [0x0d, b'A', b'C', b'P', b'I', 0] diff --git a/src/acpi-tables/src/dsdt.rs b/src/acpi-tables/src/dsdt.rs index dfb7c9b1b84..b3be80caf9d 100644 --- a/src/acpi-tables/src/dsdt.rs +++ b/src/acpi-tables/src/dsdt.rs @@ -50,13 +50,13 @@ impl Dsdt { impl Sdt for Dsdt { fn len(&self) -> usize { - self.header.length.get() as usize + usize::try_from(self.header.length.get()).unwrap() } fn write_to_guest(&mut self, mem: &AS, address: GuestAddress) -> Result<()> { mem.write_slice(self.header.as_bytes(), address)?; let address = address - .checked_add(size_of::() as u64) + .checked_add(u64::try_from(size_of::()).unwrap()) .ok_or(AcpiError::InvalidGuestAddress)?; mem.write_slice(self.definition_block.as_slice(), address)?; diff --git a/src/acpi-tables/src/madt.rs b/src/acpi-tables/src/madt.rs index eaef031e337..9002cd8dd44 100644 --- a/src/acpi-tables/src/madt.rs +++ b/src/acpi-tables/src/madt.rs @@ -133,7 +133,7 @@ impl Sdt for Madt { fn write_to_guest(&mut self, mem: &M, address: GuestAddress) -> Result<()> { mem.write_slice(self.header.as_bytes(), address)?; let address = address - .checked_add(size_of::() as u64) + .checked_add(u64::try_from(size_of::()).unwrap()) .ok_or(AcpiError::InvalidGuestAddress)?; mem.write_slice(self.interrupt_controllers.as_bytes(), address)?; diff --git a/src/acpi-tables/src/xsdt.rs b/src/acpi-tables/src/xsdt.rs index a11cadc6f75..1a7beea62fd 100644 --- a/src/acpi-tables/src/xsdt.rs +++ b/src/acpi-tables/src/xsdt.rs @@ -64,7 +64,7 @@ impl Sdt for Xsdt { fn write_to_guest(&mut self, mem: &M, address: GuestAddress) -> Result<()> { mem.write_slice(self.header.as_bytes(), address)?; let address = address - .checked_add(size_of::() as u64) + .checked_add(u64::try_from(size_of::()).unwrap()) .ok_or(AcpiError::InvalidGuestAddress)?; mem.write_slice(self.tables.as_slice(), address)?; Ok(()) diff --git a/src/cpu-template-helper/build.rs b/src/cpu-template-helper/build.rs index 5cd73550815..acf58f663c7 100644 --- a/src/cpu-template-helper/build.rs +++ b/src/cpu-template-helper/build.rs @@ -51,7 +51,7 @@ fn main() { // SAFETY: This is safe as long as `header` is valid as `KernelHeader`. let header_bytes = unsafe { std::slice::from_raw_parts( - (&header as *const KernelHeader).cast::(), + std::ptr::from_ref::(&header).cast::(), std::mem::size_of::(), ) }; diff --git a/src/cpu-template-helper/src/utils/mod.rs b/src/cpu-template-helper/src/utils/mod.rs index f23871df1a9..35d027ef1dd 100644 --- a/src/cpu-template-helper/src/utils/mod.rs +++ b/src/cpu-template-helper/src/utils/mod.rs @@ -1,6 +1,8 @@ // Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +#![allow(clippy::as_conversions)] + use std::ffi::OsString; use std::fmt::Display; use std::fs::read_to_string; diff --git a/src/firecracker/examples/uffd/fault_all_handler.rs b/src/firecracker/examples/uffd/fault_all_handler.rs index ca7601ebf25..55a77d5d193 100644 --- a/src/firecracker/examples/uffd/fault_all_handler.rs +++ b/src/firecracker/examples/uffd/fault_all_handler.rs @@ -1,6 +1,8 @@ // Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +#![allow(clippy::as_conversions)] + //! Provides functionality for a userspace page fault handler //! which loads the whole region from the backing memory file //! when a page fault occurs. diff --git a/src/firecracker/examples/uffd/uffd_utils.rs b/src/firecracker/examples/uffd/uffd_utils.rs index ab28f6f4d2e..358a481f032 100644 --- a/src/firecracker/examples/uffd/uffd_utils.rs +++ b/src/firecracker/examples/uffd/uffd_utils.rs @@ -5,6 +5,7 @@ clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::undocumented_unsafe_blocks, + clippy::as_conversions, // Not everything is used by both binaries dead_code )] diff --git a/src/firecracker/src/main.rs b/src/firecracker/src/main.rs index 739214999a4..bc717f74c8c 100644 --- a/src/firecracker/src/main.rs +++ b/src/firecracker/src/main.rs @@ -1,6 +1,8 @@ // Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +#![allow(clippy::as_conversions)] + mod api_server; mod api_server_adapter; mod generated; diff --git a/src/jailer/src/resource_limits.rs b/src/jailer/src/resource_limits.rs index 0ca4c3460db..d7ede952338 100644 --- a/src/jailer/src/resource_limits.rs +++ b/src/jailer/src/resource_limits.rs @@ -27,13 +27,13 @@ impl From for u32 { fn from(resource: Resource) -> u32 { match resource { #[allow(clippy::unnecessary_cast)] - #[allow(clippy::cast_possible_wrap)] + #[allow(clippy::cast_possible_wrap, clippy::as_conversions)] // Definition of libc::RLIMIT_FSIZE depends on the target_env: // * when equals to "musl" -> libc::RLIMIT_FSIZE is a c_int (which is an i32) // * when equals to "gnu" -> libc::RLIMIT_FSIZE is __rlimit_resource_t which is a // c_uint (which is an u32) Resource::RlimitFsize => libc::RLIMIT_FSIZE as u32, - #[allow(clippy::unnecessary_cast)] + #[allow(clippy::unnecessary_cast, clippy::as_conversions)] #[allow(clippy::cast_possible_wrap)] // Definition of libc::RLIMIT_NOFILE depends on the target_env: // * when equals to "musl" -> libc::RLIMIT_NOFILE is a c_int (which is an i32) @@ -47,14 +47,14 @@ impl From for u32 { impl From for i32 { fn from(resource: Resource) -> i32 { match resource { - #[allow(clippy::unnecessary_cast)] + #[allow(clippy::unnecessary_cast, clippy::as_conversions)] #[allow(clippy::cast_possible_wrap)] // Definition of libc::RLIMIT_FSIZE depends on the target_env: // * when equals to "musl" -> libc::RLIMIT_FSIZE is a c_int (which is an i32) // * when equals to "gnu" -> libc::RLIMIT_FSIZE is __rlimit_resource_t which is a // c_uint (which is an u32) Resource::RlimitFsize => libc::RLIMIT_FSIZE as i32, - #[allow(clippy::unnecessary_cast)] + #[allow(clippy::unnecessary_cast, clippy::as_conversions)] #[allow(clippy::cast_possible_wrap)] // Definition of libc::RLIMIT_NOFILE depends on the target_env: // * when equals to "musl" -> libc::RLIMIT_NOFILE is a c_int (which is an i32) @@ -129,7 +129,7 @@ mod tests { use super::*; #[test] - #[allow(clippy::unnecessary_cast)] + #[allow(clippy::unnecessary_cast, clippy::as_conversions)] fn test_from_resource() { assert_eq!(u32::from(Resource::RlimitFsize), libc::RLIMIT_FSIZE as u32); assert_eq!( diff --git a/src/rebase-snap/src/main.rs b/src/rebase-snap/src/main.rs index 783e2086197..012ea353811 100644 --- a/src/rebase-snap/src/main.rs +++ b/src/rebase-snap/src/main.rs @@ -100,7 +100,7 @@ fn rebase(base_file: &mut File, diff_file: &mut File) -> Result<(), FileError> { libc::sendfile64( base_file.as_raw_fd(), diff_file.as_raw_fd(), - (&mut cursor as *mut u64).cast::(), + std::ptr::from_mut::(&mut cursor).cast::(), usize::try_from(block_end.saturating_sub(cursor)).unwrap(), ) }; @@ -258,6 +258,7 @@ mod tests { .unwrap(); // 2. Diff file that has only holes + #[allow(clippy::as_conversions)] diff_file .set_len(initial_base_file_content.len() as u64) .unwrap(); diff --git a/src/seccompiler/src/bindings.rs b/src/seccompiler/src/bindings.rs index 969ea91cd1c..687e600075f 100644 --- a/src/seccompiler/src/bindings.rs +++ b/src/seccompiler/src/bindings.rs @@ -66,14 +66,16 @@ pub const SCMP_ACT_TRAP: u32 = 0x00030000; pub const SCMP_ACT_ERRNO_MASK: u32 = 0x00050000; /// Return the specified error code #[must_use] +#[allow(clippy::as_conversions)] pub const fn SCMP_ACT_ERRNO(x: u16) -> u32 { - SCMP_ACT_ERRNO_MASK | x as u32 + SCMP_ACT_ERRNO_MASK | (x as u32) } pub const SCMP_ACT_TRACE_MASK: u32 = 0x7ff00000; /// Notify a tracing process with the specified value #[must_use] +#[allow(clippy::as_conversions)] pub const fn SCMP_ACT_TRACE(x: u16) -> u32 { - SCMP_ACT_TRACE_MASK | x as u32 + SCMP_ACT_TRACE_MASK | (x as u32) } /// Allow the syscall to be executed after the action has been logged pub const SCMP_ACT_LOG: u32 = 0x7ffc0000; diff --git a/src/seccompiler/src/lib.rs b/src/seccompiler/src/lib.rs index 93b9dac2732..f6e9104a75a 100644 --- a/src/seccompiler/src/lib.rs +++ b/src/seccompiler/src/lib.rs @@ -141,7 +141,7 @@ pub fn compile_bpf( // SAFETY: Safe as all args are correct. // We can assume no one will define u32::MAX // filters for a syscall. - #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_possible_truncation, clippy::as_conversions)] unsafe { if seccomp_rule_add_array( bpf_filter, @@ -173,7 +173,7 @@ pub fn compile_bpf( memfd.rewind().map_err(CompilationError::MemfdRewind)?; // Cast is safe because usize == u64 - #[allow(clippy::cast_possible_truncation)] + #[allow(clippy::cast_possible_truncation, clippy::as_conversions)] let size = memfd.metadata().unwrap().size() as usize; // Bpf instructions are 8 byte values and 4 byte alignment. // We use u64 to satisfy these requirements. diff --git a/src/seccompiler/src/types.rs b/src/seccompiler/src/types.rs index 2035f8b8ea4..de199682cb0 100644 --- a/src/seccompiler/src/types.rs +++ b/src/seccompiler/src/types.rs @@ -60,13 +60,13 @@ impl SeccompCondition { // JIT. match self.val_len { SeccompCmpArgLen::Dword => scmp_arg_cmp { - arg: self.index as u32, + arg: u32::from(self.index), op: scmp_compare::SCMP_CMP_MASKED_EQ, datum_a: 0x00000000FFFFFFFF, datum_b: self.val, }, SeccompCmpArgLen::Qword => scmp_arg_cmp { - arg: self.index as u32, + arg: u32::from(self.index), op: scmp_compare::SCMP_CMP_EQ, datum_a: self.val, datum_b: 0, @@ -74,38 +74,38 @@ impl SeccompCondition { } } SeccompCmpOp::Ge => scmp_arg_cmp { - arg: self.index as u32, + arg: u32::from(self.index), op: scmp_compare::SCMP_CMP_GE, datum_a: self.val, datum_b: 0, }, SeccompCmpOp::Gt => scmp_arg_cmp { - arg: self.index as u32, + arg: u32::from(self.index), op: scmp_compare::SCMP_CMP_GT, datum_a: self.val, datum_b: 0, }, SeccompCmpOp::Le => scmp_arg_cmp { - arg: self.index as u32, + arg: u32::from(self.index), op: scmp_compare::SCMP_CMP_LE, datum_a: self.val, datum_b: 0, }, SeccompCmpOp::Lt => scmp_arg_cmp { - arg: self.index as u32, + arg: u32::from(self.index), op: scmp_compare::SCMP_CMP_LT, datum_a: self.val, datum_b: 0, }, SeccompCmpOp::Ne => scmp_arg_cmp { - arg: self.index as u32, + arg: u32::from(self.index), op: scmp_compare::SCMP_CMP_NE, datum_a: self.val, datum_b: 0, }, SeccompCmpOp::MaskedEq(m) => scmp_arg_cmp { - arg: self.index as u32, + arg: u32::from(self.index), op: scmp_compare::SCMP_CMP_MASKED_EQ, datum_a: m, datum_b: self.val, diff --git a/src/snapshot-editor/src/edit_memory.rs b/src/snapshot-editor/src/edit_memory.rs index 015354adfc0..1fda76f72ec 100644 --- a/src/snapshot-editor/src/edit_memory.rs +++ b/src/snapshot-editor/src/edit_memory.rs @@ -1,6 +1,8 @@ // Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +#![allow(clippy::as_conversions)] + use std::fs::OpenOptions; use std::io::{Seek, SeekFrom}; use std::os::fd::AsRawFd; diff --git a/src/utils/src/time.rs b/src/utils/src/time.rs index 46d996757b9..defa32ac5e8 100644 --- a/src/utils/src/time.rs +++ b/src/utils/src/time.rs @@ -215,7 +215,7 @@ impl TimerFd { /// Arm the timer to be triggered after `duration` and then /// at optional `interval` pub fn arm(&mut self, duration: Duration, interval: Option) { - #[allow(clippy::cast_possible_wrap)] + #[allow(clippy::cast_possible_wrap, clippy::as_conversions)] let spec = libc::itimerspec { it_value: libc::timespec { tv_sec: duration.as_secs() as i64, diff --git a/src/vmm/benches/queue.rs b/src/vmm/benches/queue.rs index bf855bc0851..61f659667ca 100644 --- a/src/vmm/benches/queue.rs +++ b/src/vmm/benches/queue.rs @@ -6,7 +6,7 @@ // * `Queue.add_used` // * `DescriptorChain.next_descriptor` -#![allow(clippy::cast_possible_truncation)] +#![allow(clippy::cast_possible_truncation, clippy::as_conversions)] use std::num::Wrapping; diff --git a/src/vmm/src/lib.rs b/src/vmm/src/lib.rs index f3cd9bad211..7fc05fa1080 100644 --- a/src/vmm/src/lib.rs +++ b/src/vmm/src/lib.rs @@ -11,6 +11,7 @@ #![warn(missing_docs)] #![warn(clippy::undocumented_unsafe_blocks)] #![allow(clippy::blanket_clippy_restriction_lints)] +#![allow(clippy::as_conversions)] /// Implements platform specific functionality. /// Supported platforms: x86_64 and aarch64. diff --git a/src/vmm/tests/devices.rs b/src/vmm/tests/devices.rs index 5a228b96f96..4dd47a44941 100644 --- a/src/vmm/tests/devices.rs +++ b/src/vmm/tests/devices.rs @@ -4,7 +4,8 @@ #![allow( clippy::cast_possible_truncation, clippy::tests_outside_test_module, - clippy::undocumented_unsafe_blocks + clippy::undocumented_unsafe_blocks, + clippy::as_conversions )] use std::os::raw::{c_int, c_void}; use std::os::unix::io::{AsRawFd, RawFd}; diff --git a/src/vmm/tests/io_uring.rs b/src/vmm/tests/io_uring.rs index b30ac53e30a..802a02840c7 100644 --- a/src/vmm/tests/io_uring.rs +++ b/src/vmm/tests/io_uring.rs @@ -1,7 +1,11 @@ // Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -#![allow(clippy::cast_possible_truncation, clippy::tests_outside_test_module)] +#![allow( + clippy::cast_possible_truncation, + clippy::tests_outside_test_module, + clippy::as_conversions +)] use std::os::unix::fs::FileExt; use std::os::unix::io::AsRawFd;