Skip to content

Commit 0ee2172

Browse files
committed
strftime: re-order items to keep impls together
1 parent 757a8b0 commit 0ee2172

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

src/format/strftime.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -427,33 +427,6 @@ impl<'a> StrftimeItems<'a> {
427427
}
428428
}
429429

430-
const HAVE_ALTERNATES: &str = "z";
431-
432-
impl<'a> Iterator for StrftimeItems<'a> {
433-
type Item = Item<'a>;
434-
435-
fn next(&mut self) -> Option<Item<'a>> {
436-
// We have items queued to return from a specifier composed of multiple formatting items.
437-
if let Some((item, remainder)) = self.queue.split_first() {
438-
self.queue = remainder;
439-
return Some(item.clone());
440-
}
441-
442-
// We are in the middle of parsing the localized formatting string of a specifier.
443-
#[cfg(feature = "unstable-locales")]
444-
if !self.locale_str.is_empty() {
445-
let (remainder, item) = self.parse_next_item(self.locale_str)?;
446-
self.locale_str = remainder;
447-
return Some(item);
448-
}
449-
450-
// Normal: we are parsing the formatting string.
451-
let (remainder, item) = self.parse_next_item(self.remainder)?;
452-
self.remainder = remainder;
453-
Some(item)
454-
}
455-
}
456-
457430
impl<'a> StrftimeItems<'a> {
458431
fn error<'b>(
459432
&mut self,
@@ -779,6 +752,33 @@ impl<'a> StrftimeItems<'a> {
779752
}
780753
}
781754

755+
impl<'a> Iterator for StrftimeItems<'a> {
756+
type Item = Item<'a>;
757+
758+
fn next(&mut self) -> Option<Item<'a>> {
759+
// We have items queued to return from a specifier composed of multiple formatting items.
760+
if let Some((item, remainder)) = self.queue.split_first() {
761+
self.queue = remainder;
762+
return Some(item.clone());
763+
}
764+
765+
// We are in the middle of parsing the localized formatting string of a specifier.
766+
#[cfg(feature = "unstable-locales")]
767+
if !self.locale_str.is_empty() {
768+
let (remainder, item) = self.parse_next_item(self.locale_str)?;
769+
self.locale_str = remainder;
770+
return Some(item);
771+
}
772+
773+
// Normal: we are parsing the formatting string.
774+
let (remainder, item) = self.parse_next_item(self.remainder)?;
775+
self.remainder = remainder;
776+
Some(item)
777+
}
778+
}
779+
780+
const HAVE_ALTERNATES: &str = "z";
781+
782782
#[cfg(test)]
783783
mod tests {
784784
use super::StrftimeItems;

0 commit comments

Comments
 (0)