style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -58,9 +58,9 @@ impl<H: Hash> AccessedNodesTracker<H> {
|
||||
impl<H: Hash + Ord> TrieRecorder<H> for AccessedNodesTracker<H> {
|
||||
fn record(&mut self, access: TrieAccess<H>) {
|
||||
match access {
|
||||
TrieAccess::NodeOwned { hash, .. } |
|
||||
TrieAccess::EncodedNode { hash, .. } |
|
||||
TrieAccess::Value { hash, .. } => {
|
||||
TrieAccess::NodeOwned { hash, .. }
|
||||
| TrieAccess::EncodedNode { hash, .. }
|
||||
| TrieAccess::Value { hash, .. } => {
|
||||
self.recorder.insert(hash);
|
||||
},
|
||||
_ => {},
|
||||
|
||||
+3
-2
@@ -654,13 +654,14 @@ impl<H: Hasher> ValueCache<'_, H> {
|
||||
stats.local_fetch_attempts.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
match self {
|
||||
Self::Fresh(map) =>
|
||||
Self::Fresh(map) => {
|
||||
if let Some(value) = map.get(key) {
|
||||
stats.local_hits.fetch_add(1, Ordering::Relaxed);
|
||||
Some(value)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
}
|
||||
},
|
||||
Self::ForStorageRoot {
|
||||
local_value_cache,
|
||||
shared_value_cache_access,
|
||||
|
||||
+2
-2
@@ -410,8 +410,8 @@ where
|
||||
H: AsRef<[u8]>,
|
||||
{
|
||||
fn eq(&self, rhs: &ValueCacheKey<H>) -> bool {
|
||||
self.storage_root.as_ref() == rhs.storage_root.as_ref() &&
|
||||
self.storage_key == &*rhs.storage_key
|
||||
self.storage_root.as_ref() == rhs.storage_root.as_ref()
|
||||
&& self.storage_key == &*rhs.storage_key
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -231,12 +231,15 @@ where
|
||||
) -> Vec<u8> {
|
||||
let contains_hash = matches!(&value, Some(Value::Node(..)));
|
||||
let mut output = match (&value, contains_hash) {
|
||||
(&None, _) =>
|
||||
partial_from_iterator_encode(partial, number_nibble, NodeKind::BranchNoValue),
|
||||
(_, false) =>
|
||||
partial_from_iterator_encode(partial, number_nibble, NodeKind::BranchWithValue),
|
||||
(_, true) =>
|
||||
partial_from_iterator_encode(partial, number_nibble, NodeKind::HashedValueBranch),
|
||||
(&None, _) => {
|
||||
partial_from_iterator_encode(partial, number_nibble, NodeKind::BranchNoValue)
|
||||
},
|
||||
(_, false) => {
|
||||
partial_from_iterator_encode(partial, number_nibble, NodeKind::BranchWithValue)
|
||||
},
|
||||
(_, true) => {
|
||||
partial_from_iterator_encode(partial, number_nibble, NodeKind::HashedValueBranch)
|
||||
},
|
||||
};
|
||||
|
||||
let bitmap_index = output.len();
|
||||
@@ -287,10 +290,12 @@ fn partial_from_iterator_encode<I: Iterator<Item = u8>>(
|
||||
NodeKind::Leaf => NodeHeader::Leaf(nibble_count).encode_to(&mut output),
|
||||
NodeKind::BranchWithValue => NodeHeader::Branch(true, nibble_count).encode_to(&mut output),
|
||||
NodeKind::BranchNoValue => NodeHeader::Branch(false, nibble_count).encode_to(&mut output),
|
||||
NodeKind::HashedValueLeaf =>
|
||||
NodeHeader::HashedValueLeaf(nibble_count).encode_to(&mut output),
|
||||
NodeKind::HashedValueBranch =>
|
||||
NodeHeader::HashedValueBranch(nibble_count).encode_to(&mut output),
|
||||
NodeKind::HashedValueLeaf => {
|
||||
NodeHeader::HashedValueLeaf(nibble_count).encode_to(&mut output)
|
||||
},
|
||||
NodeKind::HashedValueBranch => {
|
||||
NodeHeader::HashedValueBranch(nibble_count).encode_to(&mut output)
|
||||
},
|
||||
};
|
||||
output.extend(partial);
|
||||
output
|
||||
|
||||
@@ -54,16 +54,18 @@ impl Encode for NodeHeader {
|
||||
fn encode_to<T: Output + ?Sized>(&self, output: &mut T) {
|
||||
match self {
|
||||
NodeHeader::Null => output.push_byte(trie_constants::EMPTY_TRIE),
|
||||
NodeHeader::Branch(true, nibble_count) =>
|
||||
encode_size_and_prefix(*nibble_count, trie_constants::BRANCH_WITH_MASK, 2, output),
|
||||
NodeHeader::Branch(true, nibble_count) => {
|
||||
encode_size_and_prefix(*nibble_count, trie_constants::BRANCH_WITH_MASK, 2, output)
|
||||
},
|
||||
NodeHeader::Branch(false, nibble_count) => encode_size_and_prefix(
|
||||
*nibble_count,
|
||||
trie_constants::BRANCH_WITHOUT_MASK,
|
||||
2,
|
||||
output,
|
||||
),
|
||||
NodeHeader::Leaf(nibble_count) =>
|
||||
encode_size_and_prefix(*nibble_count, trie_constants::LEAF_PREFIX_MASK, 2, output),
|
||||
NodeHeader::Leaf(nibble_count) => {
|
||||
encode_size_and_prefix(*nibble_count, trie_constants::LEAF_PREFIX_MASK, 2, output)
|
||||
},
|
||||
NodeHeader::HashedValueBranch(nibble_count) => encode_size_and_prefix(
|
||||
*nibble_count,
|
||||
trie_constants::ALT_HASHING_BRANCH_WITH_MASK,
|
||||
@@ -90,10 +92,12 @@ impl Decode for NodeHeader {
|
||||
}
|
||||
match i & (0b11 << 6) {
|
||||
trie_constants::LEAF_PREFIX_MASK => Ok(NodeHeader::Leaf(decode_size(i, input, 2)?)),
|
||||
trie_constants::BRANCH_WITH_MASK =>
|
||||
Ok(NodeHeader::Branch(true, decode_size(i, input, 2)?)),
|
||||
trie_constants::BRANCH_WITHOUT_MASK =>
|
||||
Ok(NodeHeader::Branch(false, decode_size(i, input, 2)?)),
|
||||
trie_constants::BRANCH_WITH_MASK => {
|
||||
Ok(NodeHeader::Branch(true, decode_size(i, input, 2)?))
|
||||
},
|
||||
trie_constants::BRANCH_WITHOUT_MASK => {
|
||||
Ok(NodeHeader::Branch(false, decode_size(i, input, 2)?))
|
||||
},
|
||||
trie_constants::EMPTY_TRIE => {
|
||||
if i & (0b111 << 5) == trie_constants::ALT_HASHING_LEAF_PREFIX_MASK {
|
||||
Ok(NodeHeader::HashedValueLeaf(decode_size(i, input, 3)?))
|
||||
|
||||
@@ -57,14 +57,18 @@ fn fuse_nibbles_node(nibbles: &[u8], kind: NodeKind) -> impl Iterator<Item = u8>
|
||||
let size = nibbles.len();
|
||||
let iter_start = match kind {
|
||||
NodeKind::Leaf => size_and_prefix_iterator(size, trie_constants::LEAF_PREFIX_MASK, 2),
|
||||
NodeKind::BranchNoValue =>
|
||||
size_and_prefix_iterator(size, trie_constants::BRANCH_WITHOUT_MASK, 2),
|
||||
NodeKind::BranchWithValue =>
|
||||
size_and_prefix_iterator(size, trie_constants::BRANCH_WITH_MASK, 2),
|
||||
NodeKind::HashedValueLeaf =>
|
||||
size_and_prefix_iterator(size, trie_constants::ALT_HASHING_LEAF_PREFIX_MASK, 3),
|
||||
NodeKind::HashedValueBranch =>
|
||||
size_and_prefix_iterator(size, trie_constants::ALT_HASHING_BRANCH_WITH_MASK, 4),
|
||||
NodeKind::BranchNoValue => {
|
||||
size_and_prefix_iterator(size, trie_constants::BRANCH_WITHOUT_MASK, 2)
|
||||
},
|
||||
NodeKind::BranchWithValue => {
|
||||
size_and_prefix_iterator(size, trie_constants::BRANCH_WITH_MASK, 2)
|
||||
},
|
||||
NodeKind::HashedValueLeaf => {
|
||||
size_and_prefix_iterator(size, trie_constants::ALT_HASHING_LEAF_PREFIX_MASK, 3)
|
||||
},
|
||||
NodeKind::HashedValueBranch => {
|
||||
size_and_prefix_iterator(size, trie_constants::ALT_HASHING_BRANCH_WITH_MASK, 4)
|
||||
},
|
||||
};
|
||||
iter_start
|
||||
.chain(if nibbles.len() % 2 == 1 { Some(nibbles[0]) } else { None })
|
||||
|
||||
Reference in New Issue
Block a user