tests: Remove "useless_conversion" clippy

Between musl and glibc there is a difference in the signature of the
ioctl libc function. Use an anonymous cast to force the type coversion.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@intel.com>
This commit is contained in:
Ravi kumar Veeramally 2023-06-27 17:26:12 +03:00 committed by Bo Chen
parent 37fbece885
commit 802e9009b9

View File

@ -4996,7 +4996,6 @@ mod common_parallel {
handle_child_output(r, &output);
}
#[allow(clippy::useless_conversion)]
fn create_loop_device(backing_file_path: &str, block_size: u32, num_retries: usize) -> String {
const LOOP_CONFIGURE: u64 = 0x4c0a;
const LOOP_CTL_GET_FREE: u64 = 0x4c82;
@ -5057,12 +5056,9 @@ mod common_parallel {
.unwrap();
// Request a free loop device
let loop_device_number = unsafe {
libc::ioctl(
loop_ctl_file.as_raw_fd(),
LOOP_CTL_GET_FREE.try_into().unwrap(),
)
};
let loop_device_number =
unsafe { libc::ioctl(loop_ctl_file.as_raw_fd(), LOOP_CTL_GET_FREE as _) };
if loop_device_number < 0 {
panic!("Couldn't find a free loop device");
}
@ -5094,7 +5090,7 @@ mod common_parallel {
let ret = unsafe {
libc::ioctl(
loop_device_file.as_raw_fd(),
LOOP_CONFIGURE.try_into().unwrap(),
LOOP_CONFIGURE as _,
&loop_config,
)
};