Skip to content

Commit fcb5768

Browse files
author
bitcoin-rs
committed
chore: bump MSRV to 1.92.0 + adapt to clippy 1.92 pedantic strictness
Required for the next-generation storage backends (rocksdb 0.49 needs 1.89, fjall 3.1 needs 1.90, redb 4.1 needs 1.89, signet-libmdbx 0.8 needs 1.92). Picking 1.92 unlocks all four under one toolchain. Adapted to clippy 1.92: - Hand-fixed: needless_continue in mempool::pool::remove_index (loop tail); format_push_string in storage backend_equivalence (switched to fmt::Write::write!); manual const-fn additions across coinstats, pruning, p2p, utxo, etc. via 'cargo clippy --fix'. - Workspace-allowed: format_push_string, manual_let_else, missing_const_for_fn, collapsible_if, needless_continue, iter_without_into_iter, into_iter_without_iter (all new pedantic lints; style preferences not correctness gates). CI's portable job still pins 1.92; the kernel-mdbx job's elevated toolchain is no longer separate from MSRV and can fold into the main matrix. Op: extend
1 parent 927ff37 commit fcb5768

23 files changed

Lines changed: 49 additions & 42 deletions

File tree

Cargo.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ members = [
2424

2525
[workspace.package]
2626
edition = "2024"
27-
rust-version = "1.85.0"
27+
rust-version = "1.92.0"
2828
license = "MIT OR Apache-2.0"
2929
repository = "https://github.com/bitcoin-rs/bitcoin-rs"
3030
version = "0.1.0"
@@ -273,6 +273,15 @@ struct_field_names = "allow"
273273
option_if_let_else = "allow"
274274
significant_drop_tightening = "allow"
275275
redundant_pub_crate = "allow"
276+
# Clippy 1.92 added pedantic lints that fire on patterns previously clippy-clean.
277+
# These are style preferences, not correctness gates; allow at the workspace level.
278+
manual_let_else = "allow"
279+
format_push_string = "allow"
280+
missing_const_for_fn = "allow"
281+
collapsible_if = "allow"
282+
needless_continue = "allow"
283+
iter_without_into_iter = "allow"
284+
into_iter_without_iter = "allow"
276285

277286
# ============================================================================
278287
# Profiles

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
msrv = "1.85.0"
1+
msrv = "1.92.0"
22
cognitive-complexity-threshold = 15
33
type-complexity-threshold = 250
44
too-many-arguments-threshold = 8

crates/chain/src/tree.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ impl BlockTree {
181181
return Ok(());
182182
}
183183

184-
if let Some(old_tip) = self.tip.load_full() {
185-
if old_tip.tip_id != node_id {
186-
self.node_mut(old_tip.tip_id)?.status = NodeStatus::Stale;
187-
}
184+
if let Some(old_tip) = self.tip.load_full()
185+
&& old_tip.tip_id != node_id
186+
{
187+
self.node_mut(old_tip.tip_id)?.status = NodeStatus::Stale;
188188
}
189189
self.node_mut(node_id)?.status = NodeStatus::Active;
190190
let node = self.node(node_id)?;

crates/coinstats/src/muhash3072.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fn chacha20_block(key: &[u8; 32], counter: u32, out: &mut [u8]) {
147147
}
148148
}
149149

150-
fn quarter_round(state: &mut [u32; 16], a: usize, b: usize, c: usize, d: usize) {
150+
const fn quarter_round(state: &mut [u32; 16], a: usize, b: usize, c: usize, d: usize) {
151151
state[a] = state[a].wrapping_add(state[b]);
152152
state[d] = (state[d] ^ state[a]).rotate_left(16);
153153
state[c] = state[c].wrapping_add(state[d]);

crates/coinstats/src/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl CoinStats {
6464
}
6565

6666
/// Applies per-block height and transaction-count deltas.
67-
pub fn finish_block(&mut self, height: u32, tx_delta: u64) {
67+
pub const fn finish_block(&mut self, height: u32, tx_delta: u64) {
6868
self.height = height;
6969
self.tx_count = self.tx_count.saturating_add(tx_delta);
7070
}

crates/electrum/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ where
3939
}
4040

4141
/// Returns mutable subscription state for tests and embedders.
42-
pub fn subscriptions_mut(&mut self) -> &mut SessionSubscriptions {
42+
pub const fn subscriptions_mut(&mut self) -> &mut SessionSubscriptions {
4343
&mut self.subscriptions
4444
}
4545

crates/filters/src/gcs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ struct BitWriter<'a> {
165165
}
166166

167167
impl<'a> BitWriter<'a> {
168-
fn new(out: &'a mut Vec<u8>) -> Self {
168+
const fn new(out: &'a mut Vec<u8>) -> Self {
169169
Self {
170170
out,
171171
buffer: 0,
@@ -302,14 +302,14 @@ impl SipState {
302302
}
303303
}
304304

305-
fn compress(&mut self, word: u64) {
305+
const fn compress(&mut self, word: u64) {
306306
self.v3 ^= word;
307307
self.round();
308308
self.round();
309309
self.v0 ^= word;
310310
}
311311

312-
fn finalize(mut self, word: u64) -> u64 {
312+
const fn finalize(mut self, word: u64) -> u64 {
313313
self.compress(word);
314314
self.v2 ^= 0xff;
315315
self.round();
@@ -319,7 +319,7 @@ impl SipState {
319319
self.v0 ^ self.v1 ^ self.v2 ^ self.v3
320320
}
321321

322-
fn round(&mut self) {
322+
const fn round(&mut self) {
323323
self.v0 = self.v0.wrapping_add(self.v1);
324324
self.v1 = self.v1.rotate_left(13);
325325
self.v1 ^= self.v0;

crates/filters/tests/bip158_vectors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn parse_hash(hex: &str) -> TestResult<Hash256> {
9898
}
9999

100100
fn hex_to_bytes(hex: &str) -> TestResult<Vec<u8>> {
101-
if hex.len() % 2 != 0 {
101+
if !hex.len().is_multiple_of(2) {
102102
return Err("hex string has odd length".into());
103103
}
104104
let mut out = Vec::with_capacity(hex.len() / 2);

crates/index/src/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl PendingRows {
136136
self.header_rows.dedup();
137137
}
138138

139-
fn counts(&self) -> IndexRowCounts {
139+
const fn counts(&self) -> IndexRowCounts {
140140
IndexRowCounts {
141141
txids: self.txid_rows.len(),
142142
funding: self.funding_rows.len(),

crates/index/src/mempool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl MempoolRows {
121121
rows
122122
}
123123

124-
fn counts(&self) -> MempoolRowCounts {
124+
const fn counts(&self) -> MempoolRowCounts {
125125
MempoolRowCounts {
126126
txids: self.txid_rows.len(),
127127
funding: self.funding_rows.len(),

0 commit comments

Comments
 (0)