Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions src/uu/date/src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,6 @@ mod tests {
// Acquire mutex to prevent interference with other tests
let _lock = LOCALE_MUTEX.lock().unwrap();

// Save original locale (both environment and process locale)
let original_lc_all = std::env::var_os("LC_ALL");
let original_lc_time = std::env::var_os("LC_TIME");
let original_lang = std::env::var_os("LANG");

// Save current process locale
let original_process_locale = unsafe {
let ptr = libc::setlocale(libc::LC_TIME, std::ptr::null());
Expand All @@ -337,13 +332,6 @@ mod tests {
}
};

unsafe {
// Set C locale
std::env::set_var("LC_ALL", "C");
std::env::remove_var("LC_TIME");
std::env::remove_var("LANG");
}

// Get the locale format
let format = unsafe {
libc::setlocale(libc::LC_TIME, c"C".as_ptr());
Expand All @@ -364,25 +352,6 @@ mod tests {
assert!(uses_24_hour, "C locale should use 24-hour format, got: {locale_format}");
}

// Restore original environment variables
unsafe {
if let Some(val) = original_lc_all {
std::env::set_var("LC_ALL", val);
} else {
std::env::remove_var("LC_ALL");
}
if let Some(val) = original_lc_time {
std::env::set_var("LC_TIME", val);
} else {
std::env::remove_var("LC_TIME");
}
if let Some(val) = original_lang {
std::env::set_var("LANG", val);
} else {
std::env::remove_var("LANG");
}
}

// Restore original process locale
unsafe {
if let Some(locale) = original_process_locale {
Expand Down
Loading