From ab8e559343ffe7838365ceae399a5014fafcd24d Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 12 Dec 2022 17:45:26 +0000 Subject: [PATCH] block_util: Use anonymous case to handle ioctl signature difference 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: Rob Bradford --- block_util/src/async_io.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block_util/src/async_io.rs b/block_util/src/async_io.rs index f190bbfaa..6f91e6209 100644 --- a/block_util/src/async_io.rs +++ b/block_util/src/async_io.rs @@ -3,7 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause use libc::{ioctl, S_IFBLK, S_IFMT}; -use std::convert::TryInto; use std::fs::File; use std::os::unix::io::AsRawFd; use thiserror::Error; @@ -66,7 +65,6 @@ impl DiskTopology { } // libc::ioctl() takes different types on different architectures - #[allow(clippy::useless_conversion)] fn query_block_size(f: &mut File, block_size_type: BlockSize) -> std::io::Result { let mut block_size = 0; // SAFETY: FFI call with correct arguments @@ -78,9 +76,7 @@ impl DiskTopology { BlockSize::PhysicalBlock => BLKPBSZGET(), BlockSize::MinimumIo => BLKIOMIN(), BlockSize::OptimalIo => BLKIOOPT(), - } - .try_into() - .unwrap(), + } as _, &mut block_size, ) };