From 9d03fd787f2dfb9c5ea97ac2c88388fc75ef3ddd Mon Sep 17 00:00:00 2001 From: Zixuan Chen Date: Tue, 18 Jul 2023 10:10:52 +0800 Subject: [PATCH] chore: fix warnings --- crates/loro-internal/examples/encoding_refactored.rs | 1 + crates/loro-internal/src/refactor/oplog.rs | 4 ++-- crates/loro-internal/src/refactor/oplog/dag.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/loro-internal/examples/encoding_refactored.rs b/crates/loro-internal/examples/encoding_refactored.rs index 1d4dbc9a..c58490c4 100644 --- a/crates/loro-internal/examples/encoding_refactored.rs +++ b/crates/loro-internal/examples/encoding_refactored.rs @@ -56,6 +56,7 @@ fn bench_decode() { let mut txn = loro.txn().unwrap(); let mut n = 0; + #[allow(warnings)] for TextAction { pos, ins, del } in actions.iter() { if n % 10 == 0 { drop(txn); diff --git a/crates/loro-internal/src/refactor/oplog.rs b/crates/loro-internal/src/refactor/oplog.rs index ad12bd26..919e967d 100644 --- a/crates/loro-internal/src/refactor/oplog.rs +++ b/crates/loro-internal/src/refactor/oplog.rs @@ -501,8 +501,8 @@ impl OpLog { let mut total_changes = 0; let mut total_ops = 0; let mut total_atom_ops = 0; - let mut total_dag_node = self.dag.map.len(); - for (_, changes) in &self.changes { + let total_dag_node = self.dag.map.len(); + for changes in self.changes.values() { total_changes += changes.len(); for change in changes.iter() { total_ops += change.ops.len(); diff --git a/crates/loro-internal/src/refactor/oplog/dag.rs b/crates/loro-internal/src/refactor/oplog/dag.rs index 85f43479..20048092 100644 --- a/crates/loro-internal/src/refactor/oplog/dag.rs +++ b/crates/loro-internal/src/refactor/oplog/dag.rs @@ -3,7 +3,7 @@ use std::cmp::Ordering; use crate::change::Lamport; use crate::dag::{Dag, DagNode}; use crate::id::{Counter, ID}; -use crate::span::{HasId, HasLamport, HasLamportSpan}; +use crate::span::{HasId, HasLamport}; use crate::version::{Frontiers, ImVersionVector, VersionVector}; use rle::{HasIndex, HasLength, Mergable, Sliceable};