Skip to content

Commit 9c7f40b

Browse files
committed
fix(lint): suppress dead code warnings on non-Unix platforms
Add #[cfg_attr(not(unix), allow(dead_code))] to OutputEncoding::BytePreserving, CustomFormatError::InvalidUtf8, locale_output_encoding(), and decode_byte_preserving() to allow these items to be unused on non-Unix systems without triggering warnings. This improves code quality and reduces noise in builds on unsupported platforms.
1 parent a7b1227 commit 9c7f40b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/uu/date/src/date.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ enum DateSource {
8484
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8585
enum OutputEncoding {
8686
Utf8,
87+
#[cfg_attr(not(unix), allow(dead_code))]
8788
BytePreserving,
8889
}
8990

@@ -94,6 +95,7 @@ struct CustomFormat {
9495

9596
enum CustomFormatError {
9697
MissingPlus(String),
98+
#[cfg_attr(not(unix), allow(dead_code))]
9799
InvalidUtf8,
98100
}
99101

@@ -648,6 +650,7 @@ fn parse_custom_format(raw: &OsStr) -> Result<CustomFormat, CustomFormatError> {
648650
}
649651
}
650652

653+
#[cfg_attr(not(unix), allow(dead_code))]
651654
fn locale_output_encoding() -> OutputEncoding {
652655
let locale_var = ["LC_ALL", "LC_TIME", "LANG"]
653656
.iter()
@@ -667,6 +670,7 @@ fn locale_output_encoding() -> OutputEncoding {
667670
OutputEncoding::BytePreserving
668671
}
669672

673+
#[cfg_attr(not(unix), allow(dead_code))]
670674
fn decode_byte_preserving(bytes: &[u8]) -> String {
671675
bytes.iter().map(|&b| char::from(b)).collect()
672676
}

0 commit comments

Comments
 (0)