From 66759a1fe7e3fc2c2594a436ae099ae265b5c196 Mon Sep 17 00:00:00 2001 From: Yann Leretaille Date: Thu, 15 Oct 2020 18:30:20 +0200 Subject: [PATCH] refactor: only implement regex syntax validation once --- src/metadata/loader.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/metadata/loader.rs b/src/metadata/loader.rs index 1ef9e3c..3ca1001 100644 --- a/src/metadata/loader.rs +++ b/src/metadata/loader.rs @@ -633,9 +633,7 @@ fn text(reader: &mut Reader, name: &[u8]) -> Result(reader: &mut Reader, name: &[u8]) -> Result { let regex_source = text(reader, name)?; // check regular expression syntax - if let Err(err) = regex_syntax::Parser::new().parse(®ex_source) { - return Err(error::LoadMetadata::RegexSyntax(err)); - } + check_regex(®ex_source)?; Ok(regex_source) }