mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Add Cow
This commit is contained in:
parent
9538790b33
commit
a0b022afee
@ -1,3 +1,4 @@
|
|||||||
|
use std::borrow::Cow;
|
||||||
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
|
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
@ -492,9 +493,9 @@ impl<'a, A: AsRef<[u8]>> Formatter<'a, A> {
|
|||||||
new_word.push_str(&self.marks.1);
|
new_word.push_str(&self.marks.1);
|
||||||
new_word.push_str(&word[match_len..]);
|
new_word.push_str(&word[match_len..]);
|
||||||
}
|
}
|
||||||
new_word
|
Cow::Owned(new_word)
|
||||||
} else {
|
} else {
|
||||||
word.to_string()
|
Cow::Borrowed(word)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect::<String>()
|
.collect::<String>()
|
||||||
|
Loading…
Reference in New Issue
Block a user