feat: Use safest SetBuf constructor instead of new_unchecked

This commit is contained in:
Clément Renault 2019-05-21 18:02:14 +02:00
parent 8387c5b14e
commit fa099555c0
No known key found for this signature in database
GPG key ID: 0151CDAB43460DAE
4 changed files with 9 additions and 18 deletions

View file

@ -70,11 +70,8 @@ impl Indexer {
pub fn build(self) -> Indexed {
let words_doc_indexes = self.words_doc_indexes
.into_iter()
.map(|(word, mut indexes)| {
indexes.sort_unstable();
indexes.dedup();
(word, SetBuf::new_unchecked(indexes))
}).collect();
.map(|(word, indexes)| (word, SetBuf::from_dirty(indexes)))
.collect();
let docs_words = self.docs_words
.into_iter()