Skip to content

Commit

Permalink
Update mod.rs [Bug Fix in the parse_owned Function, line 75-88]
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zmuth authored Sep 29, 2024
1 parent 2e68a36 commit 225b136
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions time/src/format_description/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ pub fn parse_borrowed<const VERSION: usize>(
/// [`OwnedFormatItem`]: crate::format_description::OwnedFormatItem
pub fn parse_owned<const VERSION: usize>(
s: &str,
) -> Result<format_description::OwnedFormatItem, error::InvalidFormatDescription> {
) -> Result<crate::format_description::OwnedFormatItem, crate::error::InvalidFormatDescription> {
validate_version!(VERSION);
let mut lexed = lexer::lex::<VERSION>(s.as_bytes());
let ast = ast::parse::<_, VERSION>(&mut lexed);
let format_items = format_item::parse(ast);
let items = format_items.collect::<Result<Box<_>, _>>()?;
let items: Box<[format_item::Item<'_>]> = format_items
.map(|res| res.map(Into::into))
.collect::<Result<Vec<_>, _>>()?
.into_boxed_slice(); // Convert Vec into a boxed slice
Ok(items.into())
}

Expand Down

0 comments on commit 225b136

Please sign in to comment.