From 25f19cf98c89f5826ccf969e23f32dcfab1825fa Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Wed, 13 May 2026 20:53:26 -0700 Subject: [PATCH] lint: silence clippy::unnecessary_cast on glibc + fix doc list indent CI's lint workflow runs clippy on linux target where: - platform/fs_type/linux.rs and io/writeback/linux.rs: the i64 cast on buf.f_type / NFS_SUPER_MAGIC is unnecessary on glibc x86_64 (both already i64) but required on musl (c_ulong); silence the lint via inline allow with explanatory comment. - mux/m2ts_mux/packet.rs: doc comment continuation across lines was parsed as an unindented list item. Reworded to a single flowing sentence. --- src/io/writeback/linux.rs | 6 +++++- src/mux/m2ts_mux/packet.rs | 8 ++++---- src/platform/fs_type/linux.rs | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/io/writeback/linux.rs b/src/io/writeback/linux.rs index e7bd3d9..0d1ede3 100644 --- a/src/io/writeback/linux.rs +++ b/src/io/writeback/linux.rs @@ -321,8 +321,12 @@ fn detect_nfs(fd: RawFd) -> bool { } // `f_type` is signed (`__fsword_t`) on glibc and unsigned // (`c_ulong`) on musl. Cast both sides to i64 for a portable - // comparison. + // comparison. On glibc x86_64 both already are i64 — clippy flags + // the cast as unnecessary on that target only, but we need it for + // musl, so silence the lint. + #[allow(clippy::unnecessary_cast)] let f_type = buf.f_type as i64; + #[allow(clippy::unnecessary_cast)] let nfs_magic = libc::NFS_SUPER_MAGIC as i64; f_type == nfs_magic } diff --git a/src/mux/m2ts_mux/packet.rs b/src/mux/m2ts_mux/packet.rs index 0d6c607..81ca3ba 100644 --- a/src/mux/m2ts_mux/packet.rs +++ b/src/mux/m2ts_mux/packet.rs @@ -57,11 +57,11 @@ impl Packet { /// Append the adaptation field after the header. /// - /// `body` is the adaptation field body (flags byte + optional PCR - /// + …). `stuffing` is the number of `0xFF` stuffing bytes to + /// `body` is the adaptation field body (flags byte plus optional PCR + /// and so on). `stuffing` is the number of `0xFF` stuffing bytes to /// append after the body. The first byte of the field - /// (`adaptation_field_length`) is computed here from `body.len() + - /// stuffing`. + /// (`adaptation_field_length`) is computed here from + /// `body.len() + stuffing`. pub(super) fn append_adaptation(&mut self, body: &[u8], stuffing: usize) { let af_len = body.len() + stuffing; debug_assert!(af_len <= 183, "adaptation field overflow"); diff --git a/src/platform/fs_type/linux.rs b/src/platform/fs_type/linux.rs index 26d2969..591018e 100644 --- a/src/platform/fs_type/linux.rs +++ b/src/platform/fs_type/linux.rs @@ -32,8 +32,12 @@ pub(super) fn detect_impl(path: &Path) -> FsType { } // `f_type` is signed (`__fsword_t`) on glibc and unsigned // (`c_ulong`) on musl. Cast both sides to i64 for a portable - // comparison. + // comparison. On glibc x86_64 both already are i64 — clippy flags + // the cast as unnecessary on that target only, but we need it for + // musl, so silence the lint. + #[allow(clippy::unnecessary_cast)] let f_type = buf.f_type as i64; + #[allow(clippy::unnecessary_cast)] let nfs_magic = libc::NFS_SUPER_MAGIC as i64; if f_type == nfs_magic { return FsType::Nfs;