Skip to content

Commit

Permalink
Correct error returned by parse_rfc3339_relaxed
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Feb 4, 2024
1 parent dbf2d27 commit 1d1b336
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/format/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use core::usize;
use super::scan;
use super::{Fixed, InternalFixed, InternalInternal, Item, Numeric, Pad, Parsed};
use super::{ParseError, ParseErrorKind, ParseResult};
use super::{BAD_FORMAT, INVALID, NOT_ENOUGH, OUT_OF_RANGE, TOO_LONG, TOO_SHORT};
use super::{BAD_FORMAT, INVALID, OUT_OF_RANGE, TOO_LONG, TOO_SHORT};
use crate::{DateTime, FixedOffset, Weekday};

fn set_weekday_with_num_days_from_sunday(p: &mut Parsed, v: i64) -> ParseResult<()> {
Expand Down Expand Up @@ -572,7 +572,7 @@ fn parse_rfc3339_relaxed<'a>(parsed: &mut Parsed, mut s: &'a str) -> ParseResult
s = match parse_internal(parsed, s, DATE_ITEMS.iter()) {
Err((remainder, e)) if e.0 == ParseErrorKind::TooLong => remainder,
Err((_s, e)) => return Err(e),
Ok(_) => return Err(NOT_ENOUGH),
Ok(_) => return Err(TOO_SHORT),

Check warning on line 575 in src/format/parse.rs

View check run for this annotation

Codecov / codecov/patch

src/format/parse.rs#L575

Added line #L575 was not covered by tests
};

s = match s.as_bytes().first() {
Expand All @@ -584,7 +584,7 @@ fn parse_rfc3339_relaxed<'a>(parsed: &mut Parsed, mut s: &'a str) -> ParseResult
s = match parse_internal(parsed, s, TIME_ITEMS.iter()) {
Err((s, e)) if e.0 == ParseErrorKind::TooLong => s,
Err((_s, e)) => return Err(e),
Ok(_) => return Err(NOT_ENOUGH),
Ok(_) => return Err(TOO_SHORT),
};
s = s.trim_start();
let (s, offset) = if s.len() >= 3 && "UTC".as_bytes().eq_ignore_ascii_case(&s.as_bytes()[..3]) {
Expand Down

0 comments on commit 1d1b336

Please sign in to comment.