diff --git a/crates/loro-core/src/container/map/map_container.rs b/crates/loro-core/src/container/map/map_container.rs index c9efff83..a5e2fb73 100644 --- a/crates/loro-core/src/container/map/map_container.rs +++ b/crates/loro-core/src/container/map/map_container.rs @@ -10,7 +10,7 @@ use crate::{ op::{OpContent, OpProxy}, value::{InsertValue, LoroValue}, version::TotalOrderStamp, - InternalString, LogStore, + InternalString, }; use super::MapInsertContent; diff --git a/crates/loro-core/src/container/text/tracker.rs b/crates/loro-core/src/container/text/tracker.rs index fe3674d9..c3ec0055 100644 --- a/crates/loro-core/src/container/text/tracker.rs +++ b/crates/loro-core/src/container/text/tracker.rs @@ -81,13 +81,13 @@ impl Tracker { *id, *pos, text.len(), - &mut |v, leaf| { + &mut |_v, _leaf| { //TODO notify }, ); } - TextOpContent::Delete { id, pos, len } => todo!(), + TextOpContent::Delete { id: _, pos: _, len: _ } => todo!(), } } } @@ -103,7 +103,7 @@ mod test { #[test] fn test_turn_off() { - let mut tracker = Tracker::new(); + let _tracker = Tracker::new(); // tracker.turn_off(IdSpan::new(1, 1, 2)); } } diff --git a/crates/loro-core/src/container/text/tracker/content_map.rs b/crates/loro-core/src/container/text/tracker/content_map.rs index 9d88283b..71f796ae 100644 --- a/crates/loro-core/src/container/text/tracker/content_map.rs +++ b/crates/loro-core/src/container/text/tracker/content_map.rs @@ -1,5 +1,5 @@ use crdt_list::crdt::ListCrdt; -use crdt_list::yata::Yata; + use std::ops::{Deref, DerefMut}; use rle::{ @@ -25,12 +25,12 @@ struct CursorWithId<'tree> { impl ContentMap { #[inline] - pub(super) fn insert_yspan_at_pos(&mut self, id: ID, pos: usize, len: usize, notify: &mut F) + pub(super) fn insert_yspan_at_pos(&mut self, id: ID, pos: usize, len: usize, _notify: &mut F) where F: FnMut(&YSpan, *const LeafNode<'_, YSpan, YSpanTreeTrait>), { let (left, right) = self.get_sibling_at(pos); - let yspan = YSpan { + let _yspan = YSpan { origin_left: left.as_ref().map(|x| x.id).unwrap_or_else(ID::null), origin_right: right.as_ref().map(|x| x.id).unwrap_or_else(ID::null), id, diff --git a/crates/loro-core/src/container/text/tracker/cursor_map.rs b/crates/loro-core/src/container/text/tracker/cursor_map.rs index c0f1e828..672ca60b 100644 --- a/crates/loro-core/src/container/text/tracker/cursor_map.rs +++ b/crates/loro-core/src/container/text/tracker/cursor_map.rs @@ -27,7 +27,7 @@ pub(super) enum Marker { impl Marker { pub fn as_cursor(&self, id: ID) -> Option> { match self { - Marker::Insert { ptr, len } => { + Marker::Insert { ptr, len: _ } => { // SAFETY: tree data is always valid let node = unsafe { ptr.as_ref() }; debug_assert!(!node.is_deleted()); @@ -44,7 +44,7 @@ impl Marker { id: ID, ) -> Option> { match self { - Marker::Insert { ptr, len } => { + Marker::Insert { ptr, len: _ } => { // SAFETY: tree data is always valid let node = unsafe { ptr.as_ref() }; debug_assert!(!node.is_deleted()); @@ -72,7 +72,7 @@ impl Sliceable for Marker { impl HasLength for Marker { fn len(&self) -> usize { match self { - Marker::Insert { ptr, len } => *len, + Marker::Insert { ptr: _, len } => *len, Marker::Delete(span) => span.len(), } } diff --git a/crates/loro-core/src/container/text/tracker/yata.rs b/crates/loro-core/src/container/text/tracker/yata.rs index 35b18c34..b872742d 100644 --- a/crates/loro-core/src/container/text/tracker/yata.rs +++ b/crates/loro-core/src/container/text/tracker/yata.rs @@ -4,7 +4,6 @@ use rle::rle_tree::{iter::IterMut, SafeCursorMut, RleTreeRaw}; use crate::id::ID; use super::{ - content_map::ContentMap, y_span::{YSpan, YSpanTreeTrait}, Tracker, cursor_map::make_notify, }; @@ -13,11 +12,11 @@ use super::{ struct OpSpanSet {} impl OpSet for OpSpanSet { - fn insert(&mut self, value: &YSpan) { + fn insert(&mut self, _value: &YSpan) { todo!() } - fn contain(&self, id: ID) -> bool { + fn contain(&self, _id: ID) -> bool { todo!() } @@ -75,27 +74,27 @@ impl ListCrdt for YataImpl { }) } - fn id(op: &Self::OpUnit) -> Self::OpId { + fn id(_op: &Self::OpUnit) -> Self::OpId { todo!() } - fn cmp_id(op_a: &Self::OpUnit, op_b: &Self::OpUnit) -> std::cmp::Ordering { + fn cmp_id(_op_a: &Self::OpUnit, _op_b: &Self::OpUnit) -> std::cmp::Ordering { todo!() } - fn contains(op: &Self::OpUnit, id: Self::OpId) -> bool { + fn contains(_op: &Self::OpUnit, _id: Self::OpId) -> bool { todo!() } - fn integrate(container: &mut Self::Container, op: Self::OpUnit) { + fn integrate(_container: &mut Self::Container, _op: Self::OpUnit) { todo!() } - fn can_integrate(container: &Self::Container, op: &Self::OpUnit) -> bool { + fn can_integrate(_container: &Self::Container, _op: &Self::OpUnit) -> bool { todo!() } - fn len(container: &Self::Container) -> usize { + fn len(_container: &Self::Container) -> usize { todo!() } } diff --git a/crates/loro-core/src/dag/test.rs b/crates/loro-core/src/dag/test.rs index fa41ac1f..91d00c98 100644 --- a/crates/loro-core/src/dag/test.rs +++ b/crates/loro-core/src/dag/test.rs @@ -65,7 +65,7 @@ impl Dag for TestDag { } fn roots(&self) -> Vec<&Self::Node> { - self.nodes.iter().map(|(_, v)| &v[0]).collect() + self.nodes.values().map(|v| &v[0]).collect() } fn contains(&self, id: ID) -> bool { @@ -107,7 +107,7 @@ impl TestDag { let deps = std::mem::replace(&mut self.frontier, vec![id]); self.nodes .entry(client_id) - .or_insert(vec![]) + .or_default() .push(TestNode::new(id, self.next_lamport, deps, len)); self.next_lamport += len as u32; } @@ -162,7 +162,7 @@ impl TestDag { ); self.nodes .entry(client_id) - .or_insert(vec![]) + .or_default() .push(node.clone()); self.version_vec .insert(client_id, node.id.counter + node.len as Counter); diff --git a/crates/loro-core/src/loro.rs b/crates/loro-core/src/loro.rs index 612d2244..bb402da0 100644 --- a/crates/loro-core/src/loro.rs +++ b/crates/loro-core/src/loro.rs @@ -1,4 +1,4 @@ -use std::{pin::Pin, sync::RwLock}; +use std::{pin::Pin}; use crate::{ configure::Configure, diff --git a/crates/rle/src/rle_tree/node/internal_impl.rs b/crates/rle/src/rle_tree/node/internal_impl.rs index ea098406..96d1ec5e 100644 --- a/crates/rle/src/rle_tree/node/internal_impl.rs +++ b/crates/rle/src/rle_tree/node/internal_impl.rs @@ -325,9 +325,7 @@ impl<'a, T: Rle, A: RleTreeTrait> InternalNode<'a, T, A> { }; if let Err(new) = new { - if let Err(value) = self._insert_with_split(child_index + 1, new) { - return Err(value); - } + self._insert_with_split(child_index + 1, new)? } Ok(())