Skip to content

Commit 6de58e1

Browse files
authored
chore: fix clippy warnings (#89)
1 parent 306066d commit 6de58e1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

napi/src/options.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ impl From<Restriction> for rspack_resolver::Restriction {
217217
panic!("Should specify path or regex")
218218
}
219219
(None, Some(regex)) => {
220-
let re = Regex::new(&regex).expect(&format!("Invalid regex pattern: {}", regex));
220+
let re =
221+
Regex::new(&regex).unwrap_or_else(|_| panic!("Invalid regex pattern: {regex}"));
221222
Self::Fn(Arc::new(move |path| re.is_match(path.to_str().unwrap_or_default())))
222223
}
223224
(Some(path), None) => Self::Path(PathBuf::from(path)),

0 commit comments

Comments
 (0)