chore: cargo fix

This commit is contained in:
leeeon233 2022-12-27 15:15:07 +08:00 committed by Leonzhao
parent 065e646a7e
commit 647352aa2a
5 changed files with 7 additions and 14 deletions

View file

@ -156,7 +156,7 @@ mod run {
let buf = loro.encode(EncodeConfig::from_vv(None)).unwrap();
let mut store2 = LoroCore::default();
b.iter(|| {
let _ = store2.decode(&buf).unwrap();
store2.decode(&buf).unwrap();
})
});
}

View file

@ -296,8 +296,7 @@ impl ContainerRegistry {
self.insert(id.clone(), container);
}
let container = self.get(id).unwrap();
container
self.get(id).unwrap()
}
pub(crate) fn get_or_create_container_idx(&mut self, id: &ContainerID) -> ContainerIdx {

View file

@ -311,7 +311,7 @@ pub(super) fn decode_snapshot(
let mut container_idx2type = FxHashMap::default();
for container_id in containers.iter() {
let container_idx = store.reg.get_or_create_container_idx(&container_id);
let container_idx = store.reg.get_or_create_container_idx(container_id);
container_idx2type.insert(container_idx, container_id.container_type());
}

View file

@ -47,9 +47,7 @@ impl LoroCore {
pub fn get_list<I: Into<ContainerIdRaw>>(&mut self, id: I) -> List {
let id: ContainerIdRaw = id.into();
let mut store = self.log_store.write().unwrap();
let instance = store
.get_or_create_container(&id.with_type(ContainerType::List))
.clone();
let instance = store.get_or_create_container(&id.with_type(ContainerType::List));
let cid = store.this_client_id();
List::from_instance(instance, cid)
}
@ -58,9 +56,7 @@ impl LoroCore {
pub fn get_map<I: Into<ContainerIdRaw>>(&mut self, id: I) -> Map {
let id: ContainerIdRaw = id.into();
let mut store = self.log_store.write().unwrap();
let instance = store
.get_or_create_container(&id.with_type(ContainerType::Map))
.clone();
let instance = store.get_or_create_container(&id.with_type(ContainerType::Map));
let cid = store.this_client_id();
Map::from_instance(instance, cid)
}
@ -69,9 +65,7 @@ impl LoroCore {
pub fn get_text<I: Into<ContainerIdRaw>>(&mut self, id: I) -> Text {
let id: ContainerIdRaw = id.into();
let mut store = self.log_store.write().unwrap();
let instance = store
.get_or_create_container(&id.with_type(ContainerType::Text))
.clone();
let instance = store.get_or_create_container(&id.with_type(ContainerType::Text));
let cid = store.this_client_id();
Text::from_instance(instance, cid)
}

View file

@ -1,6 +1,6 @@
use std::{
collections::HashMap,
sync::{Arc, Mutex, Weak},
sync::{Mutex, Weak},
};
use loro_core::{