mirror of
https://github.com/msfjarvis/clipboard-substitutor
synced 2025-08-15 03:07:02 +05:30
fix: remove panicking flow
This commit is contained in:
parent
127c81292d
commit
28710ab3ed
1 changed files with 5 additions and 2 deletions
|
@ -63,8 +63,11 @@ impl Match for Matcher<'_> {
|
||||||
Matcher::EndsWith { suffix } => string.ends_with(&suffix),
|
Matcher::EndsWith { suffix } => string.ends_with(&suffix),
|
||||||
Matcher::Contains { substring } => string.contains(&substring),
|
Matcher::Contains { substring } => string.contains(&substring),
|
||||||
Matcher::Regex { pattern } => {
|
Matcher::Regex { pattern } => {
|
||||||
let regex = Regex::from_str(pattern).expect("Failed to parse regex");
|
return if let Ok(regex) = Regex::from_str(pattern) {
|
||||||
regex.is_match(string)
|
regex.is_match(string)
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Matcher::Exactly { content } => string == content,
|
Matcher::Exactly { content } => string == content,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue