ls: use cfg unix

This commit is contained in:
oech3
2026-04-23 10:15:38 +02:00
committed by Daniel Hofstetter
parent 25a5b3f0b9
commit 2f49d8eb02
2 changed files with 3 additions and 32 deletions
+2 -22
View File
@@ -35,17 +35,7 @@ use term_grid::{DEFAULT_SEPARATOR_SIZE, Direction, Filling, Grid, GridOptions};
use uucore::entries;
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
use uucore::fsxattr::has_acl;
#[cfg(any(
target_os = "linux",
target_os = "android",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "solaris",
target_vendor = "apple"
))]
#[cfg(unix)]
use uucore::libc::{dev_t, major, minor};
use uucore::{
error::UResult,
@@ -627,17 +617,7 @@ fn display_date(
}
fn display_len_or_rdev(metadata: &Metadata, config: &Config) -> SizeOrDeviceId {
#[cfg(any(
target_os = "linux",
target_os = "android",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "solaris",
target_vendor = "apple"
))]
#[cfg(unix)]
{
let ft = metadata.file_type();
if ft.is_char_device() || ft.is_block_device() {
+1 -10
View File
@@ -5054,16 +5054,7 @@ fn test_tabsize_formatting() {
.stdout_is("aaaaaaaa cccc\nbbbb dddddddd\n");
}
#[cfg(any(
target_os = "linux",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "solaris",
target_vendor = "apple"
))]
#[cfg(all(unix, not(target_os = "android")))]
#[test]
fn test_device_number() {
use std::fs::{metadata, read_dir};