From 266dca118fb25892f844f2cafdb99cfe3714ca8f Mon Sep 17 00:00:00 2001 From: can1357 Date: Wed, 1 Jul 2026 02:56:16 +0200 Subject: [PATCH] refactor(pi-walker): made file type conversion helper functions const - Converted `file_type_from_dtype` and `file_type_from_mode` into const functions. - Removed the unused `OsStringExt` import. --- crates/pi-walker/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/pi-walker/src/lib.rs b/crates/pi-walker/src/lib.rs index 6e2da0373..430c0c16f 100644 --- a/crates/pi-walker/src/lib.rs +++ b/crates/pi-walker/src/lib.rs @@ -2845,7 +2845,7 @@ mod platform { ffi::{CString, OsStr}, io, mem::{size_of, zeroed}, - os::unix::ffi::{OsStrExt, OsStringExt}, + os::unix::ffi::OsStrExt, path::Path, }; @@ -3123,7 +3123,7 @@ mod platform { &bytes[..end] } - fn file_type_from_dtype(value: u8) -> Option { + const fn file_type_from_dtype(value: u8) -> Option { match value { libc::DT_REG => Some(FileType::File), libc::DT_DIR => Some(FileType::Dir), @@ -3132,7 +3132,7 @@ mod platform { } } - fn file_type_from_mode(mode: libc::mode_t) -> Option { + const fn file_type_from_mode(mode: libc::mode_t) -> Option { match mode & libc::S_IFMT { libc::S_IFREG => Some(FileType::File), libc::S_IFDIR => Some(FileType::Dir),