From 9b2cd52b97c8f081851622f18918e0c2f61f87cc Mon Sep 17 00:00:00 2001 From: RumovZ Date: Sun, 16 May 2021 21:07:03 +0200 Subject: [PATCH 1/2] Remove SearchErrorKind::Regex as it's never used --- rslib/src/error/search.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rslib/src/error/search.rs b/rslib/src/error/search.rs index e0a751eed..9fb168fe6 100644 --- a/rslib/src/error/search.rs +++ b/rslib/src/error/search.rs @@ -34,7 +34,6 @@ pub enum SearchErrorKind { InvalidPositiveWholeNumber { provided: String, context: String }, InvalidNegativeWholeNumber { provided: String, context: String }, InvalidAnswerButton { provided: String, context: String }, - Regex(String), Other(Option), } @@ -96,9 +95,6 @@ impl SearchErrorKind { SearchErrorKind::InvalidPropOperator(ctx) => { tr.search_invalid_prop_operator(ctx.as_str()) } - SearchErrorKind::Regex(text) => { - format!("
`{}`
", text.replace('`', "'")).into() - } SearchErrorKind::Other(Some(info)) => info.into(), SearchErrorKind::Other(None) => tr.search_invalid_other(), SearchErrorKind::InvalidNumber { provided, context } => { From 92aa5404c9b03e0862f8063e254fb3a1240d0c60 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Sun, 16 May 2021 21:07:35 +0200 Subject: [PATCH 2/2] Preserve formatting of regex error --- rslib/src/error/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rslib/src/error/mod.rs b/rslib/src/error/mod.rs index b2dd0f727..400a2a602 100644 --- a/rslib/src/error/mod.rs +++ b/rslib/src/error/mod.rs @@ -75,6 +75,7 @@ impl AnkiError { } AnkiError::ParseNumError => tr.errors_parse_number_fail().into(), AnkiError::FilteredDeckError(err) => err.localized_description(tr), + AnkiError::InvalidRegex(err) => format!("
{}
", err), _ => format!("{:?}", self), } }