Skip to content

Commit 6fffe6a

Browse files
authored
chore: bump MSRV and edition (#106)
* bump MSRV to 1.85, edition to 2024 * fmt * clippy
1 parent c69e9f5 commit 6fffe6a

File tree

20 files changed

+56
-60
lines changed

20 files changed

+56
-60
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
rust: ["stable", "beta", "nightly", "1.81"] # MSRV
19+
rust: ["stable", "beta", "nightly", "1.85"] # MSRV
2020
flags: ["--no-default-features", "", "--all-features"]
2121
steps:
2222
- uses: actions/checkout@v3
@@ -29,7 +29,7 @@ jobs:
2929
- name: build
3030
run: cargo build --workspace ${{ matrix.flags }}
3131
- name: test
32-
if: ${{ matrix.rust != '1.81' }} # MSRV
32+
if: ${{ matrix.rust != '1.85' }} # MSRV
3333
run: cargo test --workspace ${{ matrix.flags }}
3434

3535
miri:

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ description = """
1010
Fast Merkle-Patricia Trie (MPT) state root calculator
1111
and proof generator for prefix-sorted nibbles
1212
"""
13-
edition = "2021"
14-
rust-version = "1.81"
13+
edition = "2024"
14+
rust-version = "1.85"
1515
license = "MIT OR Apache-2.0"
1616
categories = ["data-structures", "no-std"]
1717
keywords = ["nibbles", "trie", "mpt", "merkle", "ethereum"]
@@ -32,7 +32,7 @@ all = "warn"
3232

3333
[lints.clippy]
3434
all = { level = "warn", priority = -1 }
35-
missing-const-for-fn = "allow" # TODO: https://github.com/rust-lang/rust-clippy/issues/14020
35+
missing-const-for-fn = "allow" # TODO: https://github.com/rust-lang/rust-clippy/issues/14020
3636
use-self = "warn"
3737
redundant-clone = "warn"
3838
result_large_err = "allow"

benches/bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use alloy_trie::nodes::encode_path_leaf;
44
use criterion::{
5-
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
5+
BenchmarkGroup, Criterion, criterion_group, criterion_main, measurement::WallTime,
66
};
77
use nybbles::Nibbles;
88
use proptest::{prelude::*, strategy::ValueTree};

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.81"
1+
msrv = "1.85"

src/account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{EMPTY_ROOT_HASH, KECCAK_EMPTY};
2-
use alloy_primitives::{keccak256, B256, U256};
2+
use alloy_primitives::{B256, U256, keccak256};
33
use alloy_rlp::{RlpDecodable, RlpEncodable};
44

55
/// Represents an TrieAccount in the account trie.
@@ -62,7 +62,7 @@ mod quantity {
6262
#[cfg(test)]
6363
mod tests {
6464
use super::*;
65-
use alloy_primitives::{hex, U256};
65+
use alloy_primitives::{U256, hex};
6666
use alloy_rlp::Decodable;
6767

6868
#[test]

src/hash_builder/mod.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//! The implementation of the hash builder.
22
33
use super::{
4+
BranchNodeCompact, EMPTY_ROOT_HASH, Nibbles, TrieMask,
45
nodes::{BranchNodeRef, ExtensionNodeRef, LeafNodeRef},
56
proof::ProofRetainer,
6-
BranchNodeCompact, Nibbles, TrieMask, EMPTY_ROOT_HASH,
77
};
8-
use crate::{nodes::RlpNode, proof::ProofNodes, HashMap};
8+
use crate::{HashMap, nodes::RlpNode, proof::ProofNodes};
99
use alloc::vec::Vec;
10-
use alloy_primitives::{keccak256, B256};
10+
use alloy_primitives::{B256, keccak256};
1111
use alloy_rlp::EMPTY_STRING_CODE;
1212
use core::cmp;
1313
use tracing::trace;
@@ -183,11 +183,7 @@ impl HashBuilder {
183183

184184
fn current_root(&self) -> B256 {
185185
if let Some(node_ref) = self.stack.last() {
186-
if let Some(hash) = node_ref.as_hash() {
187-
hash
188-
} else {
189-
keccak256(node_ref)
190-
}
186+
if let Some(hash) = node_ref.as_hash() { hash } else { keccak256(node_ref) }
191187
} else {
192188
EMPTY_ROOT_HASH
193189
}
@@ -455,7 +451,7 @@ mod tests {
455451
use super::*;
456452
use crate::{nodes::LeafNode, triehash_trie_root};
457453
use alloc::collections::BTreeMap;
458-
use alloy_primitives::{b256, hex, U256};
454+
use alloy_primitives::{U256, b256, hex};
459455
use alloy_rlp::Encodable;
460456

461457
// Hashes the keys, RLP encodes the values, compares the trie builder with the upstream root.

src/hash_builder/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use alloc::vec::Vec;
2-
use alloy_primitives::{hex, B256};
2+
use alloy_primitives::{B256, hex};
33
use core::fmt;
44

55
/// Hash builder value.

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub use alloy_primitives::map::HashMap;
4444
#[doc(no_inline)]
4545
pub use nybbles::{self, Nibbles};
4646

47-
use alloy_primitives::{b256, B256};
47+
use alloy_primitives::{B256, b256};
4848

4949
/// Root hash of an empty trie.
5050
pub const EMPTY_ROOT_HASH: B256 =

src/mask.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,7 @@ impl TrieMask {
7979
/// Returns the index of the first bit set in the mask, or `None` if the mask is empty.
8080
#[inline]
8181
pub const fn first_set_bit_index(self) -> Option<u8> {
82-
if self.is_empty() {
83-
None
84-
} else {
85-
Some(self.0.trailing_zeros() as u8)
86-
}
82+
if self.is_empty() { None } else { Some(self.0.trailing_zeros() as u8) }
8783
}
8884

8985
/// Set bit at a specified index.

src/nodes/branch.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use super::{super::TrieMask, RlpNode, CHILD_INDEX_RANGE};
2-
use alloy_primitives::{hex, B256};
3-
use alloy_rlp::{length_of_length, Buf, BufMut, Decodable, Encodable, Header, EMPTY_STRING_CODE};
1+
use super::{super::TrieMask, CHILD_INDEX_RANGE, RlpNode};
2+
use alloy_primitives::{B256, hex};
3+
use alloy_rlp::{Buf, BufMut, Decodable, EMPTY_STRING_CODE, Encodable, Header, length_of_length};
44
use core::{fmt, ops::Range, slice::Iter};
55

66
use alloc::sync::Arc;
@@ -352,7 +352,7 @@ mod tests {
352352
assert_eq!(BranchNode::decode(&mut &encoded[..]).unwrap(), branch_with_ext);
353353

354354
let full = BranchNode::new(
355-
core::iter::repeat(RlpNode::word_rlp(&B256::repeat_byte(23))).take(16).collect(),
355+
core::iter::repeat_n(RlpNode::word_rlp(&B256::repeat_byte(23)), 16).collect(),
356356
TrieMask::new(u16::MAX),
357357
);
358358
let encoded = alloy_rlp::encode(&full);

0 commit comments

Comments
 (0)