push: Panic on Regex construction error
This commit is contained in:
parent
ed7c26ff9f
commit
4105169577
@ -392,7 +392,8 @@ impl StrExt for str {
|
||||
// The word characters in ASCII compatible mode (with the `-u` flag) match the
|
||||
// definition in the spec: any character not in the set `[A-Za-z0-9_]`.
|
||||
let regex = format!(r"(?-u:^|\W|\b){}(?-u:\b|\W|$)", chunks.concat());
|
||||
Regex::new(®ex).ok().filter(|re| re.is_match(self.as_bytes())).is_some()
|
||||
let re = Regex::new(®ex).expect("regex construction should succeed");
|
||||
re.is_match(self.as_bytes())
|
||||
} else {
|
||||
match self.find(pattern) {
|
||||
Some(start) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user