Skip to content

Commit 492e2ee

Browse files
slicing--
1 parent 1ff571f commit 492e2ee

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

time/src/parsing/parsable.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,9 @@ impl sealed::Sealed for Rfc3339 {
635635
// readability, to specify a full-date and full-time separated by
636636
// (say) a space character.
637637
// Specifically, rusqlite uses space separators.
638-
let input = if input.is_empty() {
639-
return Err(InvalidComponent("separator").into());
640-
} else {
641-
&input[1..]
642-
};
638+
let input = input
639+
.get(1..)
640+
.ok_or_else(|| InvalidComponent("separator"))?;
643641

644642
let ParsedItem(input, hour) =
645643
exactly_n_digits::<2, _>(input).ok_or(InvalidComponent("hour"))?;

0 commit comments

Comments
 (0)