From 77b1546583eac31e4432ba30cb348bc12a606bff Mon Sep 17 00:00:00 2001 From: RumovZ Date: Sun, 16 Jan 2022 04:46:27 +0100 Subject: [PATCH] Remove redundant error mapping (#1593) Helpful regex error in Find&Replace was obscured by generic "Invalid input" error. --- rslib/src/findreplace.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rslib/src/findreplace.rs b/rslib/src/findreplace.rs index c1b0c0d66..fd31aae27 100644 --- a/rslib/src/findreplace.rs +++ b/rslib/src/findreplace.rs @@ -7,7 +7,7 @@ use regex::Regex; use crate::{ collection::Collection, - error::{AnkiError, Result}, + error::Result, notes::{NoteId, TransformNoteOutput}, prelude::*, text::normalize_to_nfc, @@ -35,7 +35,7 @@ impl FindReplaceContext { ) -> Result { Ok(FindReplaceContext { nids, - search: Regex::new(search_re).map_err(|_| AnkiError::invalid_input("invalid regex"))?, + search: Regex::new(search_re)?, replacement: repl.into(), field_name, })