Skip to content

Commit dad03d3

Browse files
committed
make clippy happy
1 parent 389a74d commit dad03d3

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

ipld/hamt/src/hamt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ where
477477
///
478478
/// for kv in &hamt {
479479
/// let (k, v) = kv?;
480-
/// println!("{k:?}: {v}");
480+
/// println!("{:?}: {}", k.as_ref(), v.as_ref());
481481
/// }
482482
///
483483
/// # anyhow::Ok(())

ipld/hamt/src/iter.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2021-2023 Protocol Labs
22
// SPDX-License-Identifier: Apache-2.0, MIT
33
use std::borrow::Borrow;
4-
use std::fmt::Display;
54
use std::iter::FusedIterator;
65

76
use forest_hash_utils::BytesKey;
@@ -39,7 +38,7 @@ impl<'a, V> From<std::slice::Iter<'a, V>> for StackItem<'a, V> {
3938
}
4039
}
4140

42-
impl<'a, V> From<std::vec::IntoIter<V>> for StackItem<'a, V> {
41+
impl<V> From<std::vec::IntoIter<V>> for StackItem<'_, V> {
4342
fn from(value: std::vec::IntoIter<V>) -> Self {
4443
Self::IntoIter(value)
4544
}
@@ -62,12 +61,6 @@ pub enum IterItem<'a, V> {
6261
Owned(V),
6362
}
6463

65-
impl<V: Display> Display for IterItem<'_, V> {
66-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
67-
self.as_ref().fmt(f)
68-
}
69-
}
70-
7164
impl<V> AsRef<V> for IterItem<'_, V> {
7265
fn as_ref(&self) -> &V {
7366
match self {
@@ -77,17 +70,7 @@ impl<V> AsRef<V> for IterItem<'_, V> {
7770
}
7871
}
7972

80-
impl<V: PartialEq> PartialEq<V> for IterItem<'_, V> {
81-
fn eq(&self, other: &V) -> bool {
82-
self.as_ref().eq(other)
83-
}
84-
85-
fn ne(&self, other: &V) -> bool {
86-
self.as_ref().ne(other)
87-
}
88-
}
89-
90-
impl<'a, V> From<V> for IterItem<'a, V> {
73+
impl<V> From<V> for IterItem<'_, V> {
9174
fn from(value: V) -> Self {
9275
Self::Owned(value)
9376
}
@@ -140,6 +123,7 @@ where
140123
}
141124
IterItem::Owned(node) => {
142125
stack.push(StackItem::from(
126+
#[allow(clippy::unnecessary_to_owned)]
143127
node.pointers[node.index_for_bit_pos(idx)..]
144128
.to_vec()
145129
.into_iter(),
@@ -173,6 +157,7 @@ where
173157
conf,
174158
store,
175159
stack,
160+
#[allow(clippy::unnecessary_to_owned)]
176161
current: values[offset..].to_vec().into_iter().into(),
177162
}),
178163
None => Err(Error::StartKeyNotFound),

ipld/hamt/src/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ where
3636
{
3737
fn clone(&self) -> Self {
3838
Self {
39-
bitfield: self.bitfield.clone(),
39+
bitfield: self.bitfield,
4040
pointers: self.pointers.clone(),
4141
hash: Default::default(),
4242
}

0 commit comments

Comments
 (0)