chore: Prefer using const names to avoid typos

This commit is contained in:
Clément Renault 2019-09-05 13:22:53 +02:00
parent fd880e0a0e
commit e5763e73eb
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -21,8 +21,10 @@ use self::update::apply_documents_deletion;
use self::update::apply_synonyms_addition;
use self::update::apply_synonyms_deletion;
const INDEXES_KEY: &str = "indexes";
fn load_indexes(tree: &sled::Tree) -> Result<HashSet<String>, Error> {
match tree.get("indexes")? {
match tree.get(INDEXES_KEY)? {
Some(bytes) => Ok(bincode::deserialize(&bytes)?),
None => Ok(HashSet::new())
}
@ -54,7 +56,7 @@ impl Database {
fn set_indexes(&self, value: &HashSet<String>) -> Result<(), Error> {
let bytes = bincode::serialize(value)?;
self.inner.insert("indexes", bytes)?;
self.inner.insert(INDEXES_KEY, bytes)?;
Ok(())
}