Skip to content

Commit 280aa68

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 7927741 commit 280aa68

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

@@ -608,6 +610,7 @@ fn parse_custom_format(raw: &OsStr) -> Result<CustomFormat, CustomFormatError> {
608610
}
609611
}
610612

613+
#[cfg_attr(not(unix), allow(dead_code))]
611614
fn locale_output_encoding() -> OutputEncoding {
612615
let locale_var = ["LC_ALL", "LC_TIME", "LANG"]
613616
.iter()
@@ -627,6 +630,7 @@ fn locale_output_encoding() -> OutputEncoding {
627630
OutputEncoding::BytePreserving
628631
}
629632

633+
#[cfg_attr(not(unix), allow(dead_code))]
630634
fn decode_byte_preserving(bytes: &[u8]) -> String {
631635
bytes.iter().map(|&b| char::from(b)).collect()
632636
}

0 commit comments

Comments
 (0)