mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-22 15:42:23 -05:00
refactor(parser): Switch to by-ref builder
Since nothing is being moved into `Parser`, we don't get any performance benefit with a moving builder, so switching to a by-ref builder.
This commit is contained in:
parent
3cf9d8672c
commit
039664339d
1 changed files with 2 additions and 2 deletions
|
@ -16,12 +16,12 @@ impl ParserBuilder {
|
|||
Default::default()
|
||||
}
|
||||
|
||||
pub fn ignore_hex(mut self, yes: bool) -> Self {
|
||||
pub fn ignore_hex(&mut self, yes: bool) -> &mut Self {
|
||||
self.ignore_hex = yes;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> Parser {
|
||||
pub fn build(&self) -> Parser {
|
||||
let pattern = r#"\b(\p{Alphabetic}|\d|_|')+\b"#;
|
||||
let words_str = regex::Regex::new(pattern).unwrap();
|
||||
let words_bytes = regex::bytes::Regex::new(pattern).unwrap();
|
||||
|
|
Loading…
Reference in a new issue