cleanup name resolution for backward compatibility

so it builds with rustc 1.13
This commit is contained in:
David Kellum 2018-01-12 16:08:34 -08:00
parent 353a7bbbc4
commit 0e6d1d49b7
1 changed files with 18 additions and 19 deletions

View File

@ -281,38 +281,37 @@ impl<Tz: TimeZone> DateTime<Tz> where Tz::Offset: fmt::Display {
fn rfc3339_via_items(&self, subform: Option<Fixed>, use_z: bool) -> String fn rfc3339_via_items(&self, subform: Option<Fixed>, use_z: bool) -> String
{ {
use format::Item::*;
use format::Numeric::*; use format::Numeric::*;
use format::Pad::Zero; use format::Pad::Zero;
use format::Fixed::*;
use format::Fixed::Nanosecond;
const PREFIX: &'static [Item<'static>] = &[ const PREFIX: &'static [Item<'static>] = &[
Numeric(Year, Zero), Item::Numeric(Year, Zero),
Literal("-"), Item::Literal("-"),
Numeric(Month, Zero), Item::Numeric(Month, Zero),
Literal("-"), Item::Literal("-"),
Numeric(Day, Zero), Item::Numeric(Day, Zero),
Literal("T"), Item::Literal("T"),
Numeric(Hour, Zero), Item::Numeric(Hour, Zero),
Literal(":"), Item::Literal(":"),
Numeric(Minute, Zero), Item::Numeric(Minute, Zero),
Literal(":"), Item::Literal(":"),
Numeric(Second, Zero), Item::Numeric(Second, Zero),
]; ];
let ssitem = match subform { let ssitem = match subform {
None => None, None => None,
Some(sf) => match sf { Some(sf) => match sf {
Nanosecond | Fixed::Nanosecond |
Nanosecond3 | Nanosecond6 | Nanosecond9 => Some(Fixed(sf)), Fixed::Nanosecond3 |
Fixed::Nanosecond6 |
Fixed::Nanosecond9 => Some(Item::Fixed(sf)),
_ => panic!("Unsupported rfc_3339p subsecond format {:?}", sf) _ => panic!("Unsupported rfc_3339p subsecond format {:?}", sf)
} }
}; };
let tzitem = Fixed(match use_z { let tzitem = Item::Fixed(match use_z {
true => TimezoneOffsetColonZ, true => Fixed::TimezoneOffsetColonZ,
false => TimezoneOffsetColon false => Fixed::TimezoneOffsetColon
}); });
match ssitem { match ssitem {