From 72e52d8925a76b56295d6a2a2c056d99df0665cb Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Tue, 1 Nov 2022 17:53:57 +0800 Subject: [PATCH] chore: cargo fix --- crates/loro-core/src/container/map/tests.rs | 8 ++++---- crates/loro-core/src/container/text/tracker.rs | 5 ++++- crates/loro-core/src/container/text/tracker/y_span.rs | 2 -- crates/loro-core/src/dag.rs | 1 + crates/loro-core/src/lib.rs | 2 +- crates/loro-core/src/log_store.rs | 4 ++-- crates/loro-core/src/op.rs | 2 +- crates/loro-core/tests/test.rs | 4 ++-- crates/loro-wasm/src/lib.rs | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/crates/loro-core/src/container/map/tests.rs b/crates/loro-core/src/container/map/tests.rs index 0fe4663e..99180631 100644 --- a/crates/loro-core/src/container/map/tests.rs +++ b/crates/loro-core/src/container/map/tests.rs @@ -15,8 +15,8 @@ use crate::{fx_map, value::InsertValue, LoroCore, LoroValue}; #[test] fn basic() { let mut loro = LoroCore::default(); - let weak = Irc::downgrade(&loro.log_store); - let mut container = loro.get_or_create_root_map("map".into()).unwrap(); + let _weak = Irc::downgrade(&loro.log_store); + let mut container = loro.get_or_create_root_map("map").unwrap(); container.insert("haha".into(), InsertValue::Int32(1)); let ans = fx_map!( "haha".into() => LoroValue::Integer(1) @@ -37,8 +37,8 @@ mod map_proptest { value in prop::collection::vec(gen_insert_value(), 0..10 * PROPTEST_FACTOR_10) ) { let mut loro = LoroCore::default(); - let weak = Irc::downgrade(&loro.log_store); - let mut container = loro.get_or_create_root_map("map".into()).unwrap(); + let _weak = Irc::downgrade(&loro.log_store); + let mut container = loro.get_or_create_root_map("map").unwrap(); let mut map: HashMap = HashMap::new(); for (k, v) in key.iter().zip(value.iter()) { map.insert(k.clone(), v.clone()); diff --git a/crates/loro-core/src/container/text/tracker.rs b/crates/loro-core/src/container/text/tracker.rs index 11c58cfa..2dcee2be 100644 --- a/crates/loro-core/src/container/text/tracker.rs +++ b/crates/loro-core/src/container/text/tracker.rs @@ -4,13 +4,16 @@ use smallvec::SmallVec; use crate::{ container::{list::list_op::ListOp, text::tracker::yata_impl::YataImpl}, debug_log, - id::{ClientID, Counter, ID}, + id::{Counter, ID}, op::OpContent, span::{HasIdSpan, IdSpan}, version::IdSpanVector, VersionVector, }; +#[allow(unused)] +use crate::ClientID; + use self::{ content_map::ContentMap, cursor_map::{make_notify, CursorMap, IdSpanQueryResult}, diff --git a/crates/loro-core/src/container/text/tracker/y_span.rs b/crates/loro-core/src/container/text/tracker/y_span.rs index 0b217ec5..8205acc3 100644 --- a/crates/loro-core/src/container/text/tracker/y_span.rs +++ b/crates/loro-core/src/container/text/tracker/y_span.rs @@ -180,8 +180,6 @@ impl HasLength for YSpan { #[cfg(any(test, features = "fuzzing"))] pub mod test { use crate::{ - container::{ContainerID, ContainerType}, - id::ROOT_ID, op::{InsertContent, OpContent}, ContentType, Op, ID, }; diff --git a/crates/loro-core/src/dag.rs b/crates/loro-core/src/dag.rs index 635aee1c..4af3a792 100644 --- a/crates/loro-core/src/dag.rs +++ b/crates/loro-core/src/dag.rs @@ -12,6 +12,7 @@ use std::{ fmt::Debug, }; +#[allow(unused)] use colored::Colorize; use fxhash::{FxHashMap, FxHashSet}; use rle::{HasLength, Sliceable}; diff --git a/crates/loro-core/src/lib.rs b/crates/loro-core/src/lib.rs index 4c4bc9a1..a8398b61 100644 --- a/crates/loro-core/src/lib.rs +++ b/crates/loro-core/src/lib.rs @@ -32,7 +32,7 @@ pub use error::LoroError; pub(crate) mod macros; pub(crate) use change::{Lamport, Timestamp}; pub(crate) use id::{ClientID, ID}; -pub(crate) use op::{ContentType, InsertContentTrait, Op, OpType, RemoteOp}; +pub(crate) use op::{ContentType, InsertContentTrait, Op, OpType}; pub(crate) type InternalString = DefaultAtom; diff --git a/crates/loro-core/src/log_store.rs b/crates/loro-core/src/log_store.rs index 8130ed58..59f41e96 100644 --- a/crates/loro-core/src/log_store.rs +++ b/crates/loro-core/src/log_store.rs @@ -20,7 +20,7 @@ use crate::{ isomorph::{Irc, IsoRw, IsoWeak}, op::RemoteOp, span::{HasCounterSpan, HasIdSpan, HasLamportSpan, IdSpan}, - InternalString, Lamport, Op, Timestamp, VersionVector, ID, + Lamport, Op, Timestamp, VersionVector, ID, }; const _YEAR: u64 = 365 * 24 * 60 * 60; @@ -454,7 +454,7 @@ fn size_of() { id::ID, op::{InsertContent, Op}, span::IdSpan, - Container, InsertValue, + Container, InsertValue, InternalString, }; println!("Change {}", std::mem::size_of::()); println!("Op {}", std::mem::size_of::()); diff --git a/crates/loro-core/src/op.rs b/crates/loro-core/src/op.rs index 6750a8d0..8b3931b5 100644 --- a/crates/loro-core/src/op.rs +++ b/crates/loro-core/src/op.rs @@ -136,7 +136,7 @@ impl Sliceable for Op { Op { counter: (self.counter + from as Counter), content, - container: self.container.clone(), + container: self.container, } } } diff --git a/crates/loro-core/tests/test.rs b/crates/loro-core/tests/test.rs index 54e58ad2..c1c31ffa 100644 --- a/crates/loro-core/tests/test.rs +++ b/crates/loro-core/tests/test.rs @@ -31,7 +31,7 @@ fn test() { drop(text_container); store.import(store_b.export(store.vv())); - let mut text_container = store.get_or_create_root_text("haha".into()).unwrap(); + let mut text_container = store.get_or_create_root_text("haha").unwrap(); let value = text_container.get_value(); let value = value.as_string().unwrap(); assert_eq!(value.as_str(), "63417892"); @@ -43,7 +43,7 @@ fn test() { drop(text_container); store_b.import(store.export(Default::default())); - let mut text_container = store_b.get_or_create_root_text("haha".into()).unwrap(); + let mut text_container = store_b.get_or_create_root_text("haha").unwrap(); text_container.check(); let value = text_container.get_value(); let value = value.as_string().unwrap(); diff --git a/crates/loro-wasm/src/lib.rs b/crates/loro-wasm/src/lib.rs index dd4125e0..e7927f68 100644 --- a/crates/loro-wasm/src/lib.rs +++ b/crates/loro-wasm/src/lib.rs @@ -5,7 +5,7 @@ use std::{ use loro_core::{ container::{Container, ContainerID}, - InsertValue, LoroCore, LoroError, + InsertValue, LoroCore, }; use wasm_bindgen::prelude::*;