Skip to content

Commit

Permalink
refactor: only implement regex syntax validation once
Browse files Browse the repository at this point in the history
  • Loading branch information
yannleretaille committed Oct 15, 2020
1 parent 6ef21c0 commit 66759a1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/metadata/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,7 @@ fn text<R: BufRead>(reader: &mut Reader<R>, name: &[u8]) -> Result<String, error
fn text_check_regex<R: BufRead>(reader: &mut Reader<R>, name: &[u8]) -> Result<String, error::LoadMetadata> {
let regex_source = text(reader, name)?;
// check regular expression syntax
if let Err(err) = regex_syntax::Parser::new().parse(&regex_source) {
return Err(error::LoadMetadata::RegexSyntax(err));
}
check_regex(&regex_source)?;
Ok(regex_source)
}

Expand Down

0 comments on commit 66759a1

Please sign in to comment.