diff --git a/ci/github.sh b/ci/github.sh index 681ea03cbf..479f29f7a7 100755 --- a/ci/github.sh +++ b/ci/github.sh @@ -6,7 +6,7 @@ set -euo pipefail source "${BASH_SOURCE[0]%/*}/_shlib.sh" TEST_TZS=(ACST-9:30 EST4 UTC0 Asia/Katmandu) -FEATURES=(std serde clock "alloc serde" locales) +FEATURES=(std serde clock "alloc serde" "std locales") RUST_113_FEATURES=(rustc-serialize serde) main() { 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};