diff --git a/time/src/parsing/parsable.rs b/time/src/parsing/parsable.rs index efac79b97..8386d132f 100644 --- a/time/src/parsing/parsable.rs +++ b/time/src/parsing/parsable.rs @@ -635,11 +635,9 @@ impl sealed::Sealed for Rfc3339 { // readability, to specify a full-date and full-time separated by // (say) a space character. // Specifically, rusqlite uses space separators. - let input = if input.is_empty() { - return Err(InvalidComponent("separator").into()); - } else { - &input[1..] - }; + let input = input + .get(1..) + .ok_or_else(|| InvalidComponent("separator"))?; let ParsedItem(input, hour) = exactly_n_digits::<2, _>(input).ok_or(InvalidComponent("hour"))?;