mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-22 23:52:12 -05:00
refactor(typos): Remove unused calculations
In #293, we moved where we were filtering out results but never switched from `filter_map` to map`, so this does that.
This commit is contained in:
parent
1559bc74bf
commit
5b29113ec8
1 changed files with 5 additions and 10 deletions
|
@ -46,10 +46,7 @@ impl Tokenizer {
|
|||
} else {
|
||||
itertools::Either::Right(ascii_parser::iter_identifiers(content.as_bytes()))
|
||||
};
|
||||
iter.filter_map(move |identifier| {
|
||||
let offset = offset(content.as_bytes(), identifier.as_bytes());
|
||||
self.transform(identifier, offset)
|
||||
})
|
||||
iter.map(move |identifier| self.transform(identifier, content.as_bytes()))
|
||||
}
|
||||
|
||||
pub fn parse_bytes<'c>(&'c self, content: &'c [u8]) -> impl Iterator<Item = Identifier<'c>> {
|
||||
|
@ -60,17 +57,15 @@ impl Tokenizer {
|
|||
} else {
|
||||
itertools::Either::Right(ascii_parser::iter_identifiers(content))
|
||||
};
|
||||
iter.filter_map(move |identifier| {
|
||||
let offset = offset(content, identifier.as_bytes());
|
||||
self.transform(identifier, offset)
|
||||
})
|
||||
iter.map(move |identifier| self.transform(identifier, content))
|
||||
}
|
||||
|
||||
fn transform<'i>(&self, identifier: &'i str, offset: usize) -> Option<Identifier<'i>> {
|
||||
fn transform<'i>(&self, identifier: &'i str, content: &[u8]) -> Identifier<'i> {
|
||||
debug_assert!(!identifier.is_empty());
|
||||
|
||||
let case = Case::None;
|
||||
Some(Identifier::new_unchecked(identifier, case, offset))
|
||||
let offset = offset(content, identifier.as_bytes());
|
||||
Identifier::new_unchecked(identifier, case, offset)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue