File tree Expand file tree Collapse file tree
src/cortex-compact/src/auto_compaction Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ pub fn chrono_timestamp() -> String {
2020
2121/// Estimate available disk space in bytes (platform-specific).
2222#[ cfg( unix) ]
23+ #[ allow( clippy:: unnecessary_cast) ] // Cast needed for cross-platform: macOS has u32, Linux has u64
2324pub fn available_disk_space ( path : & Path ) -> io:: Result < u64 > {
2425 use std:: ffi:: CString ;
2526 use std:: mem:: MaybeUninit ;
@@ -31,7 +32,8 @@ pub fn available_disk_space(path: &Path) -> io::Result<u64> {
3132 let mut statvfs = MaybeUninit :: < libc:: statvfs > :: uninit ( ) ;
3233 if libc:: statvfs ( c_path. as_ptr ( ) , statvfs. as_mut_ptr ( ) ) == 0 {
3334 let statvfs = statvfs. assume_init ( ) ;
34- Ok ( statvfs. f_bavail * statvfs. f_frsize )
35+ // Cast to u64 for cross-platform compatibility (macOS has u32 for f_bavail)
36+ Ok ( ( statvfs. f_bavail as u64 ) * ( statvfs. f_frsize as u64 ) )
3537 } else {
3638 Err ( io:: Error :: last_os_error ( ) )
3739 }
You can’t perform that action at this time.
0 commit comments