Skip to content

Commit bfb44b1

Browse files
Fix clippy warnings: Allow platform-dependent type conversions in fs.rs
Add #[allow(clippy::useless_conversion)] to .into() calls that are: - Required on some platforms (macOS: st_nlink is u16) - Redundant on others (Linux aarch64: st_nlink is u64) This allows the code to work correctly on all platforms while suppressing clippy warnings where the conversion is unnecessary. Fixes: - line 150: st_nlink.into() (u16 on macOS, u64 on Linux aarch64) - line 169: st_ino.into() (varies by platform)
1 parent e8a1918 commit bfb44b1

File tree

1 file changed

+3
-0
lines changed
  • src/uucore/src/lib/features

1 file changed

+3
-0
lines changed

src/uucore/src/lib/features/fs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ impl FileInformation {
147147
not(target_pointer_width = "64")
148148
)
149149
))]
150+
#[allow(clippy::useless_conversion)]
151+
// st_nlink is u16 on macOS but u64 on Linux aarch64
150152
return self.0.st_nlink.into();
151153
#[cfg(target_os = "aix")]
152154
return self.0.st_nlink.try_into().unwrap();
@@ -166,6 +168,7 @@ impl FileInformation {
166168
target_os = "netbsd",
167169
not(target_pointer_width = "64")
168170
))]
171+
#[allow(clippy::useless_conversion)] // st_ino types vary by platform
169172
return self.0.st_ino.into();
170173
}
171174
}

0 commit comments

Comments
 (0)