mirror of
https://github.com/crate-ci/typos.git
synced 2026-10-17 09:35:11 +02: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:
+2
-2
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user