Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/braille.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2289,19 +2289,14 @@ fn handle_contractions(full_chars: &[char], start: usize, end: usize, mut result
}

fn init_patterns(contractions: &[Replacement]) -> RegexSet {
let mut vec: Vec<&str> = Vec::with_capacity(contractions.len());
for contraction in contractions {
vec.push(&contraction.pattern);
}
return RegexSet::new(&vec).unwrap();
let patterns = contractions.iter().map(|c| c.pattern.as_str());
return RegexSet::new(patterns).unwrap();
}

fn init_regex(contractions: &[Replacement]) -> Vec<Regex> {
let mut vec = Vec::with_capacity(contractions.len());
for contraction in contractions {
vec.push(Regex::new(&contraction.pattern).unwrap());
}
return vec;
return contractions.iter()
.map(|c| Regex::new(&c.pattern).unwrap())
.collect();
}
}

Expand Down
Loading