chore: cargo fix

This commit is contained in:
Zixuan Chen 2022-10-03 18:01:14 +08:00
parent ec596792f6
commit 33992626d2
8 changed files with 23 additions and 26 deletions

View file

@ -10,7 +10,7 @@ use crate::{
op::{OpContent, OpProxy}, op::{OpContent, OpProxy},
value::{InsertValue, LoroValue}, value::{InsertValue, LoroValue},
version::TotalOrderStamp, version::TotalOrderStamp,
InternalString, LogStore, InternalString,
}; };
use super::MapInsertContent; use super::MapInsertContent;

View file

@ -81,13 +81,13 @@ impl Tracker {
*id, *id,
*pos, *pos,
text.len(), text.len(),
&mut |v, leaf| { &mut |_v, _leaf| {
//TODO notify //TODO notify
}, },
); );
} }
TextOpContent::Delete { id, pos, len } => todo!(), TextOpContent::Delete { id: _, pos: _, len: _ } => todo!(),
} }
} }
} }
@ -103,7 +103,7 @@ mod test {
#[test] #[test]
fn test_turn_off() { fn test_turn_off() {
let mut tracker = Tracker::new(); let _tracker = Tracker::new();
// tracker.turn_off(IdSpan::new(1, 1, 2)); // tracker.turn_off(IdSpan::new(1, 1, 2));
} }
} }

View file

@ -1,5 +1,5 @@
use crdt_list::crdt::ListCrdt; use crdt_list::crdt::ListCrdt;
use crdt_list::yata::Yata;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use rle::{ use rle::{
@ -25,12 +25,12 @@ struct CursorWithId<'tree> {
impl ContentMap { impl ContentMap {
#[inline] #[inline]
pub(super) fn insert_yspan_at_pos<F>(&mut self, id: ID, pos: usize, len: usize, notify: &mut F) pub(super) fn insert_yspan_at_pos<F>(&mut self, id: ID, pos: usize, len: usize, _notify: &mut F)
where where
F: FnMut(&YSpan, *const LeafNode<'_, YSpan, YSpanTreeTrait>), F: FnMut(&YSpan, *const LeafNode<'_, YSpan, YSpanTreeTrait>),
{ {
let (left, right) = self.get_sibling_at(pos); 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_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), origin_right: right.as_ref().map(|x| x.id).unwrap_or_else(ID::null),
id, id,

View file

@ -27,7 +27,7 @@ pub(super) enum Marker {
impl Marker { impl Marker {
pub fn as_cursor(&self, id: ID) -> Option<SafeCursor<'_, 'static, YSpan, YSpanTreeTrait>> { pub fn as_cursor(&self, id: ID) -> Option<SafeCursor<'_, 'static, YSpan, YSpanTreeTrait>> {
match self { match self {
Marker::Insert { ptr, len } => { Marker::Insert { ptr, len: _ } => {
// SAFETY: tree data is always valid // SAFETY: tree data is always valid
let node = unsafe { ptr.as_ref() }; let node = unsafe { ptr.as_ref() };
debug_assert!(!node.is_deleted()); debug_assert!(!node.is_deleted());
@ -44,7 +44,7 @@ impl Marker {
id: ID, id: ID,
) -> Option<SafeCursorMut<'_, 'static, YSpan, YSpanTreeTrait>> { ) -> Option<SafeCursorMut<'_, 'static, YSpan, YSpanTreeTrait>> {
match self { match self {
Marker::Insert { ptr, len } => { Marker::Insert { ptr, len: _ } => {
// SAFETY: tree data is always valid // SAFETY: tree data is always valid
let node = unsafe { ptr.as_ref() }; let node = unsafe { ptr.as_ref() };
debug_assert!(!node.is_deleted()); debug_assert!(!node.is_deleted());
@ -72,7 +72,7 @@ impl Sliceable for Marker {
impl HasLength for Marker { impl HasLength for Marker {
fn len(&self) -> usize { fn len(&self) -> usize {
match self { match self {
Marker::Insert { ptr, len } => *len, Marker::Insert { ptr: _, len } => *len,
Marker::Delete(span) => span.len(), Marker::Delete(span) => span.len(),
} }
} }

View file

@ -4,7 +4,6 @@ use rle::rle_tree::{iter::IterMut, SafeCursorMut, RleTreeRaw};
use crate::id::ID; use crate::id::ID;
use super::{ use super::{
content_map::ContentMap,
y_span::{YSpan, YSpanTreeTrait}, y_span::{YSpan, YSpanTreeTrait},
Tracker, cursor_map::make_notify, Tracker, cursor_map::make_notify,
}; };
@ -13,11 +12,11 @@ use super::{
struct OpSpanSet {} struct OpSpanSet {}
impl OpSet<YSpan, ID> for OpSpanSet { impl OpSet<YSpan, ID> for OpSpanSet {
fn insert(&mut self, value: &YSpan) { fn insert(&mut self, _value: &YSpan) {
todo!() todo!()
} }
fn contain(&self, id: ID) -> bool { fn contain(&self, _id: ID) -> bool {
todo!() todo!()
} }
@ -75,27 +74,27 @@ impl ListCrdt for YataImpl {
}) })
} }
fn id(op: &Self::OpUnit) -> Self::OpId { fn id(_op: &Self::OpUnit) -> Self::OpId {
todo!() 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!() todo!()
} }
fn contains(op: &Self::OpUnit, id: Self::OpId) -> bool { fn contains(_op: &Self::OpUnit, _id: Self::OpId) -> bool {
todo!() todo!()
} }
fn integrate(container: &mut Self::Container, op: Self::OpUnit) { fn integrate(_container: &mut Self::Container, _op: Self::OpUnit) {
todo!() todo!()
} }
fn can_integrate(container: &Self::Container, op: &Self::OpUnit) -> bool { fn can_integrate(_container: &Self::Container, _op: &Self::OpUnit) -> bool {
todo!() todo!()
} }
fn len(container: &Self::Container) -> usize { fn len(_container: &Self::Container) -> usize {
todo!() todo!()
} }
} }

View file

@ -65,7 +65,7 @@ impl Dag for TestDag {
} }
fn roots(&self) -> Vec<&Self::Node> { 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 { fn contains(&self, id: ID) -> bool {
@ -107,7 +107,7 @@ impl TestDag {
let deps = std::mem::replace(&mut self.frontier, vec![id]); let deps = std::mem::replace(&mut self.frontier, vec![id]);
self.nodes self.nodes
.entry(client_id) .entry(client_id)
.or_insert(vec![]) .or_default()
.push(TestNode::new(id, self.next_lamport, deps, len)); .push(TestNode::new(id, self.next_lamport, deps, len));
self.next_lamport += len as u32; self.next_lamport += len as u32;
} }
@ -162,7 +162,7 @@ impl TestDag {
); );
self.nodes self.nodes
.entry(client_id) .entry(client_id)
.or_insert(vec![]) .or_default()
.push(node.clone()); .push(node.clone());
self.version_vec self.version_vec
.insert(client_id, node.id.counter + node.len as Counter); .insert(client_id, node.id.counter + node.len as Counter);

View file

@ -1,4 +1,4 @@
use std::{pin::Pin, sync::RwLock}; use std::{pin::Pin};
use crate::{ use crate::{
configure::Configure, configure::Configure,

View file

@ -325,9 +325,7 @@ impl<'a, T: Rle, A: RleTreeTrait<T>> InternalNode<'a, T, A> {
}; };
if let Err(new) = new { if let Err(new) = new {
if let Err(value) = self._insert_with_split(child_index + 1, new) { self._insert_with_split(child_index + 1, new)?
return Err(value);
}
} }
Ok(()) Ok(())