Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test-support/reference-trie/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ mod tests {
use trie_db::{nibble_ops::NIBBLE_PER_BYTE, node::Node};

const _: fn() -> () = || {
#[allow(dead_code)]
struct AssertTrieDBRawIteratorIsSendAndSync
where
trie_db::TrieDBRawIterator<NoExtensionLayout>: Send + Sync;
Expand Down
8 changes: 4 additions & 4 deletions trie-db/src/nibble/nibbleslice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<'a> NibbleSlice<'a> {
}

/// Get nibble slice from a `NodeKey`.
pub fn from_stored(i: &NodeKey) -> NibbleSlice {
pub fn from_stored(i: &NodeKey) -> NibbleSlice<'_> {
NibbleSlice::new_offset(&i.1[..], i.0)
}

Expand Down Expand Up @@ -166,7 +166,7 @@ impl<'a> NibbleSlice<'a> {

/// Return `Partial` representation of this slice:
/// first encoded byte and following slice.
pub fn right(&'a self) -> Partial {
pub fn right(&'a self) -> Partial<'a> {
let split = self.offset / nibble_ops::NIBBLE_PER_BYTE;
let nb = (self.len() % nibble_ops::NIBBLE_PER_BYTE) as u8;
if nb > 0 {
Expand Down Expand Up @@ -237,7 +237,7 @@ impl<'a> NibbleSlice<'a> {
/// Return left portion of `NibbleSlice`, if the slice
/// originates from a full key it will be the `Prefix of
/// the node`.
pub fn left(&'a self) -> Prefix {
pub fn left(&'a self) -> Prefix<'a> {
let split = self.offset / nibble_ops::NIBBLE_PER_BYTE;
let ix = (self.offset % nibble_ops::NIBBLE_PER_BYTE) as u8;
if ix == 0 {
Expand All @@ -250,7 +250,7 @@ impl<'a> NibbleSlice<'a> {
/// Get [`Prefix`] representation of the inner data.
///
/// This means the entire inner data will be returned as [`Prefix`], ignoring any `offset`.
pub fn original_data_as_prefix(&self) -> Prefix {
pub fn original_data_as_prefix(&self) -> Prefix<'_> {
(&self.data, None)
}

Expand Down
4 changes: 2 additions & 2 deletions trie-db/src/nibble/nibblevec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl NibbleVec {
}

/// Get `Prefix` representation of this `NibbleVec`.
pub fn as_prefix(&self) -> Prefix {
pub fn as_prefix(&self) -> Prefix<'_> {
let split = self.len / nibble_ops::NIBBLE_PER_BYTE;
let pos = (self.len % nibble_ops::NIBBLE_PER_BYTE) as u8;
if pos == 0 {
Expand Down Expand Up @@ -208,7 +208,7 @@ impl NibbleVec {
}

/// Try to treat this `NibbleVec` as a `NibbleSlice`. Works only if there is no padding.
pub fn as_nibbleslice(&self) -> Option<NibbleSlice> {
pub fn as_nibbleslice(&self) -> Option<NibbleSlice<'_>> {
if self.len % nibble_ops::NIBBLE_PER_BYTE == 0 {
Some(NibbleSlice::new(self.inner()))
} else {
Expand Down
8 changes: 4 additions & 4 deletions trie-db/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub enum ValueOwned<H> {

impl<H: AsRef<[u8]> + Copy> ValueOwned<H> {
/// Returns self as [`Value`].
pub fn as_value(&self) -> Value {
pub fn as_value(&self) -> Value<'_> {
match self {
Self::Inline(data, _) => Value::Inline(&data),
Self::Node(hash) => Value::Node(hash.as_ref()),
Expand Down Expand Up @@ -228,7 +228,7 @@ impl Node<'_> {
}
Ok(())
})
.collect::<Result<_, _, _>>()?;
.collect::<Result<Vec<()>, _, _>>()?;
childs_owned
} else {
Vec::with_capacity(0)
Expand Down Expand Up @@ -256,7 +256,7 @@ impl Node<'_> {
}
Ok(())
})
.collect::<Result<_, _, _>>()?;
.collect::<Result<Vec<()>, _, _>>()?;
childs_owned
} else {
Vec::with_capacity(0)
Expand Down Expand Up @@ -670,7 +670,7 @@ impl<D: Borrow<[u8]>> OwnedNode<D> {
}

/// Construct a `Node` by borrowing data from this struct.
pub fn node(&self) -> Node {
pub fn node(&self) -> Node<'_> {
self.plan.build(self.data.borrow())
}
}
2 changes: 1 addition & 1 deletion trie-db/src/proof/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl<'a, L: TrieLayout> StackEntry<'a, L> {
})
}

fn value(&self) -> Option<Value> {
fn value(&self) -> Option<Value<'_>> {
if let Some(hash) = self.next_value_hash.as_ref() {
Some(Value::Node(hash.as_ref()))
} else {
Expand Down
Loading