From 61c17d7a9f589353ec3006d7a1897f3997964700 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Sun, 12 Jul 2020 21:13:39 +0200 Subject: [PATCH] WIP Forked at: aaee91222802471c656480ddb49b6f1e53a69a96 Parent branch: chronotope/main --- src/format/mod.rs | 22 +++++++++++----------- src/format/strftime.rs | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/format/mod.rs b/src/format/mod.rs index 36104b78a3..7ec243b9ce 100644 --- a/src/format/mod.rs +++ b/src/format/mod.rs @@ -38,7 +38,7 @@ use offset::{FixedOffset, Offset}; use {Datelike, Timelike}; use {ParseWeekdayError, Weekday}; -#[cfg(any(all(feature = "locales", any(feature = "alloc", feature = "std")), test))] +#[cfg(any(all(feature = "locales", any(feature = "alloc", feature = "std", test))))] mod locales; pub use self::parse::parse; @@ -391,7 +391,7 @@ pub struct FormatError(FormatErrorKind); #[derive(Debug, Clone, PartialEq, Eq, Copy)] enum FormatErrorKind { /// The locale is unknown or not available. - #[cfg(any(feature = "locales", test))] + #[cfg(feature = "locales")] UnknownLocale, /// Format error. @@ -412,7 +412,7 @@ pub type FormatResult = Result; impl fmt::Display for FormatError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.0 { - #[cfg(any(feature = "locales", test))] + #[cfg(feature = "locales")] FormatErrorKind::UnknownLocale => write!(f, "the locale is unknown or not available"), FormatErrorKind::Format => write!(f, "{}", fmt::Error), FormatErrorKind::InsufficientArguments => { @@ -463,18 +463,18 @@ fn format_inner<'a>( #[allow(unused_variables)] locale: &str, ) -> FormatResult<()> { // full and abbreviated month and weekday names - #[cfg(any(feature = "locales", test))] + #[cfg(feature = "locales")] let short_months = locales::short_months(locale)?; - #[cfg(any(feature = "locales", test))] + #[cfg(feature = "locales")] let long_months = locales::long_months(locale)?; - #[cfg(any(feature = "locales", test))] + #[cfg(feature = "locales")] let short_weekdays = locales::short_weekdays(locale)?; - #[cfg(any(feature = "locales", test))] + #[cfg(feature = "locales")] let long_weekdays = locales::long_weekdays(locale)?; - #[cfg(not(any(feature = "locales", test)))] + #[cfg(not(feature = "locales"))] let short_months = &["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; - #[cfg(not(any(feature = "locales", test)))] + #[cfg(not(feature = "locales"))] let long_months = &[ "January", "February", @@ -489,9 +489,9 @@ fn format_inner<'a>( "November", "December", ]; - #[cfg(not(any(feature = "locales", test)))] + #[cfg(not(feature = "locales"))] let short_weekdays = &["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; - #[cfg(not(any(feature = "locales", test)))] + #[cfg(not(feature = "locales"))] let long_weekdays = &["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; diff --git a/src/format/strftime.rs b/src/format/strftime.rs index 942fd04105..5a5280a893 100644 --- a/src/format/strftime.rs +++ b/src/format/strftime.rs @@ -519,7 +519,7 @@ fn test_strftime_docs() { assert_eq!(dt.format("%%").to_string(), "%"); } -#[cfg(test)] +#[cfg(all(feature = "locales", test))] #[test] fn test_strftime_docs_localized() { use {FixedOffset, TimeZone, Timelike};