Skip to content

Commit 9a3e990

Browse files
authored
Merge pull request #777 from loro-dev/fix-c-warnings
chore: fix clippy warnings
2 parents 71998dd + 7d3197a commit 9a3e990

16 files changed

Lines changed: 26 additions & 16 deletions

File tree

crates/delta/src/delta_rope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<V: DeltaValue, Attr: DeltaAttr> DeltaRope<V, Attr> {
213213
/// - You can peek the next item.
214214
///
215215
/// It's useful to implement algorithms related to Delta
216-
pub fn iter_with_len(&self) -> Iter<V, Attr> {
216+
pub fn iter_with_len(&self) -> Iter<'_, V, Attr> {
217217
Iter::new(self)
218218
}
219219

crates/kv-store/src/sstable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl SsTable {
325325
self.data.clone()
326326
}
327327

328-
pub fn iter(&self) -> SsTableIter {
328+
pub fn iter(&self) -> SsTableIter<'_> {
329329
SsTableIter::new(self)
330330
}
331331

crates/loro-internal/src/arena.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl SharedArena {
133133
f(&mut guards);
134134
}
135135

136-
fn get_arena_guards(&self) -> ArenaGuards {
136+
fn get_arena_guards(&self) -> ArenaGuards<'_> {
137137
ArenaGuards {
138138
container_id_to_idx: self.inner.container_id_to_idx.lock().unwrap(),
139139
container_idx_to_id: self.inner.container_idx_to_id.lock().unwrap(),

crates/loro-internal/src/container/tree/bool_rle_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl BoolRleVec {
113113
self.len == 0
114114
}
115115

116-
pub fn iter(&self) -> BoolRleVecIter {
116+
pub fn iter(&self) -> BoolRleVecIter<'_> {
117117
BoolRleVecIter {
118118
rle_vec: self,
119119
index: 0,

crates/loro-internal/src/dag.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ impl<T: Dag + ?Sized> DagUtils for T {
197197
}
198198
}
199199

200+
#[allow(dead_code)]
200201
fn get_version_vector<'a, Get, D>(get: &'a Get, id: ID) -> VersionVector
201202
where
202203
Get: Fn(ID) -> Option<D>,

crates/loro-internal/src/dag/iter.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ impl Ord for IdHeapItem {
2222
}
2323
}
2424

25+
#[allow(dead_code)]
2526
pub(crate) fn iter_dag_with_vv<T, D: Dag<Node = T>>(dag: &D) -> DagIteratorVV<'_, T> {
2627
DagIteratorVV {
2728
dag,
@@ -30,6 +31,7 @@ pub(crate) fn iter_dag_with_vv<T, D: Dag<Node = T>>(dag: &D) -> DagIteratorVV<'_
3031
}
3132
}
3233

34+
#[allow(dead_code)]
3335
pub(crate) fn iter_dag<T>(dag: &dyn Dag<Node = T>) -> DagIterator<'_, T> {
3436
DagIterator {
3537
dag,

crates/loro-internal/src/dag/mermaid.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use super::*;
2+
#[allow(dead_code)]
23
struct BreakPoints {
34
break_points: FxHashMap<PeerID, FxHashSet<Counter>>,
45
/// start ID to ID. The target ID may be in the middle of an op.
@@ -7,6 +8,7 @@ struct BreakPoints {
78
links: FxHashMap<ID, Vec<ID>>,
89
}
910

11+
#[allow(dead_code)]
1012
struct Output {
1113
clients: FxHashMap<PeerID, Vec<IdSpan>>,
1214
/// start ID to start ID.
@@ -15,6 +17,7 @@ struct Output {
1517
links: FxHashMap<ID, Vec<ID>>,
1618
}
1719

20+
#[allow(dead_code)]
1821
fn to_str(output: Output) -> String {
1922
let mut s = String::new();
2023
let mut indent_level = 0;
@@ -70,6 +73,7 @@ fn to_str(output: Output) -> String {
7073
s
7174
}
7275

76+
#[allow(dead_code)]
7377
fn break_points_to_output(input: BreakPoints) -> Output {
7478
let mut output = Output {
7579
clients: FxHashMap::default(),
@@ -112,6 +116,7 @@ fn break_points_to_output(input: BreakPoints) -> Output {
112116
output
113117
}
114118

119+
#[allow(dead_code)]
115120
fn get_dag_break_points<T: DagNode>(dag: &impl Dag<Node = T>) -> BreakPoints {
116121
let mut break_points = BreakPoints {
117122
break_points: FxHashMap::default(),
@@ -140,6 +145,7 @@ fn get_dag_break_points<T: DagNode>(dag: &impl Dag<Node = T>) -> BreakPoints {
140145
break_points
141146
}
142147

148+
#[allow(dead_code)]
143149
pub(crate) fn dag_to_mermaid<T: DagNode>(dag: &impl Dag<Node = T>) -> String {
144150
to_str(break_points_to_output(get_dag_break_points(dag)))
145151
}

crates/loro-internal/src/delta/map.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ impl<T> MapDiff<T> {
7979
}
8080

8181
#[derive(Clone, Debug, Serialize)]
82+
#[allow(dead_code)]
8283
pub struct MapDiffRaw<T> {
8384
pub(crate) added: FxHashMap<InternalString, T>,
8485
pub(crate) deleted: FxHashSet<InternalString>,

crates/loro-internal/src/encoding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ const MIN_HEADER_SIZE: usize = 22;
377377
pub(crate) fn parse_header_and_body(
378378
bytes: &[u8],
379379
check_checksum: bool,
380-
) -> Result<ParsedHeaderAndBody, LoroError> {
380+
) -> Result<ParsedHeaderAndBody<'_>, LoroError> {
381381
let reader = &bytes;
382382
if bytes.len() < MIN_HEADER_SIZE {
383383
return Err(LoroError::DecodeError("Invalid import data".into()));

crates/loro-internal/src/encoding/arena.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl ValueDecodedArenasTrait for DecodedArenas<'_> {
129129
}
130130
}
131131

132-
pub fn decode_arena(bytes: &[u8]) -> LoroResult<DecodedArenas> {
132+
pub fn decode_arena(bytes: &[u8]) -> LoroResult<DecodedArenas<'_>> {
133133
let arenas = EncodedArenas::decode_arenas(bytes)?;
134134
Ok(DecodedArenas {
135135
peer_ids: PeerIdArena::decode(arenas.peer_id_arena)?,
@@ -174,7 +174,7 @@ impl EncodedArenas<'_> {
174174
ans
175175
}
176176

177-
fn decode_arenas(bytes: &[u8]) -> LoroResult<EncodedArenas> {
177+
fn decode_arenas(bytes: &[u8]) -> LoroResult<EncodedArenas<'_>> {
178178
let (peer_id_arena, rest) = read_arena(bytes)?;
179179
let (container_arena, rest) = read_arena(rest)?;
180180
let (key_arena, rest) = read_arena(rest)?;

0 commit comments

Comments
 (0)