From 716f44031a39c5e43fb441ecc470db76efc23dd4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 14 Jun 2026 11:24:36 +0900 Subject: refactor(pcre): drop Result from Preg method return types The Preg methods panic on PCRE failure (per the file header rationale), so their anyhow::Result wrappers never carried an Err. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/repository/array_repository.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/repository/array_repository.rs') diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs index b7d862d..cfc804f 100644 --- a/crates/shirabe/src/repository/array_repository.rs +++ b/crates/shirabe/src/repository/array_repository.rs @@ -321,11 +321,11 @@ impl RepositoryInterface for ArrayRepository { r#type: Option, ) -> anyhow::Result> { let regex = if mode == crate::repository::SEARCH_FULLTEXT { - let parts = Preg::split("{\\s+}", &preg_quote(&query, None)).unwrap_or_default(); + let parts = Preg::split("{\\s+}", &preg_quote(&query, None)); format!("{{(?:{})}}i", implode("|", &parts)) } else { // vendor/name searches expect the caller to have preg_quoted the query - let parts = Preg::split("{\\s+}", &query).unwrap_or_default(); + let parts = Preg::split("{\\s+}", &query); format!("{{(?:{})}}i", implode("|", &parts)) }; @@ -361,10 +361,9 @@ impl RepositoryInterface for ArrayRepository { .get_description() .unwrap_or_default() ), - ) - .unwrap_or(false); + ); - if Preg::is_match(®ex, &name).unwrap_or(false) || fulltext_match { + if Preg::is_match(®ex, &name) || fulltext_match { if mode == crate::repository::SEARCH_VENDOR { matches.insert( name.clone(), -- cgit v1.3.1