Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Forked at: aaee912
Parent branch: chronotope/main
  • Loading branch information
cecton committed Jul 12, 2020
1 parent 9b7fd23 commit 356bd12
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ci/github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
22 changes: 11 additions & 11 deletions src/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -412,7 +412,7 @@ pub type FormatResult<T> = Result<T, FormatError>;
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 => {
Expand Down Expand Up @@ -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",
Expand All @@ -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"];

Expand Down
2 changes: 1 addition & 1 deletion src/format/strftime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit 356bd12

Please sign in to comment.