diff --git a/src/format/scan.rs b/src/format/scan.rs index 39f48c5..0676fc1 100644 --- a/src/format/scan.rs +++ b/src/format/scan.rs @@ -6,16 +6,22 @@ * Various scanning routines for the parser. */ -use std::iter; - use Weekday; use super::{ParseResult, TOO_SHORT, INVALID, OUT_OF_RANGE}; /// Returns true when two slices are equal case-insensitively (in ASCII). /// Assumes that the `pattern` is already converted to lower case. fn equals(s: &str, pattern: &str) -> bool { - iter::order::equals(s.as_bytes().iter().map(|&c| match c { b'A'...b'Z' => c + 32, _ => c }), - pattern.as_bytes().iter().cloned()) + let mut xs = s.as_bytes().iter().map(|&c| match c { b'A'...b'Z' => c + 32, _ => c }); + let mut ys = pattern.as_bytes().iter().cloned(); + loop { + match (xs.next(), ys.next()) { + (None, None) => return true, + (None, _) | (_, None) => return false, + (Some(x), Some(y)) if x != y => return false, + _ => (), + } + } } /// Tries to parse the non-negative number from `min` to `max` digits. diff --git a/src/lib.rs b/src/lib.rs index 92cee67..98f8ac1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -267,7 +267,7 @@ Advanced time zone handling is not yet supported (but is planned in 0.3). #![doc(html_root_url = "https://lifthrasiir.github.io/rust-chrono/")] -#![feature(core, std_misc, zero_one)] // lib stability features as per RFC #507 +#![feature(std_misc, zero_one)] // lib stability features as per RFC #507 #![cfg_attr(test, feature(test))] // ditto #![deny(missing_docs)]