mirror of
https://github.com/chronotope/chrono.git
synced 2025-10-02 07:21:41 +00:00
strftime: move error() method below caller
This commit is contained in:
parent
d516c2764d
commit
e5f6be7db4
@ -426,22 +426,6 @@ impl<'a> StrftimeItems<'a> {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn error<'b>(
|
|
||||||
&mut self,
|
|
||||||
original: &'b str,
|
|
||||||
error_len: &mut usize,
|
|
||||||
ch: Option<char>,
|
|
||||||
) -> (&'b str, Item<'b>) {
|
|
||||||
if !self.lenient {
|
|
||||||
return (&original[*error_len..], Item::Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(c) = ch {
|
|
||||||
*error_len -= c.len_utf8();
|
|
||||||
}
|
|
||||||
(&original[*error_len..], Item::Literal(&original[..*error_len]))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_next_item(&mut self, mut remainder: &'a str) -> Option<(&'a str, Item<'a>)> {
|
fn parse_next_item(&mut self, mut remainder: &'a str) -> Option<(&'a str, Item<'a>)> {
|
||||||
use InternalInternal::*;
|
use InternalInternal::*;
|
||||||
use Item::{Literal, Space};
|
use Item::{Literal, Space};
|
||||||
@ -732,6 +716,22 @@ impl<'a> StrftimeItems<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn error<'b>(
|
||||||
|
&mut self,
|
||||||
|
original: &'b str,
|
||||||
|
error_len: &mut usize,
|
||||||
|
ch: Option<char>,
|
||||||
|
) -> (&'b str, Item<'b>) {
|
||||||
|
if !self.lenient {
|
||||||
|
return (&original[*error_len..], Item::Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(c) = ch {
|
||||||
|
*error_len -= c.len_utf8();
|
||||||
|
}
|
||||||
|
(&original[*error_len..], Item::Literal(&original[..*error_len]))
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "unstable-locales")]
|
#[cfg(feature = "unstable-locales")]
|
||||||
fn switch_to_locale_str(
|
fn switch_to_locale_str(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user