Scripts: same_folder builds without a needless bool on Windows

On Windows the Unix block in same_folder is compiled out, which left
`if a == b { return true; } false` and failed clippy's needless_bool
lint with -D warnings in the Windows CI run. The early return now sits
inside the Unix block and the other platforms compare the paths.
Behavior is unchanged on every platform.
This commit is contained in:
dotCooCoo committed 2026-12-03 00:09:32 -08:00
1 parent 96ba49f5bd
commit 4e90d6c211
1 file changed
+8 -4
@@ -386,17 +386,21 @@ thread_local! {
/// file number, so a path spelled in another letter case on a volume that ignores case still
/// matches. On Windows a real path carries the letter case stored on disk.
fn same_folder(a: &std::path::Path, b: &std::path::Path) -> bool {
if a == b {
return true;
}
#[cfg(unix)]
{
use std::os::unix::fs::MetadataExt;
if a == b {
return true;
}
if let (Ok(x), Ok(y)) = (std::fs::metadata(a), std::fs::metadata(b)) {
return x.dev() == y.dev() && x.ino() == y.ino();
}
false
}
#[cfg(not(unix))]
{
a == b
}
false
}
/// Whether two existing paths name one file on disk, such as two hard links to it: the same device