From 6cdbb04820fcd78642a81854080369b5fbee598f Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Tue, 19 Dec 2023 16:38:53 +0000 Subject: [PATCH 1/3] clippy: whitelist uninhabited_references lint This lint triggers on `fn input_len(&self) -> usize { match *self {} }` where Self is an infallible type, claiming that the dereference of self is UB. Maybe it would be, if this were possible. But it's not, and this is literally the only point of using infallible types, so this lint is always wrong. Enabled in rustc 1.76 as warn by default. --- bitcoin/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index 0ebbe5a2..51474e2a 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -38,6 +38,7 @@ #![cfg_attr(fuzzing, allow(dead_code, unused_imports))] // Exclude clippy lints we don't think are valuable #![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134 +#![allow(clippy::uninhabited_references)] // falsely claims that 100% safe code is UB // Disable 16-bit support at least for now as we can't guarantee it yet. #[cfg(target_pointer_width = "16")] From 5fd731f0957ea6015c7d4d102238ce67e2a68236 Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Tue, 19 Dec 2023 19:02:06 +0100 Subject: [PATCH 2/3] Don't match on complex expression Passing a complex expression to `match` is hard to read. Assign it to a variable first. --- bitcoin/src/blockdata/transaction.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index 44b3f32f..6d4c0e91 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -1929,7 +1929,8 @@ mod tests { let mut witness: Vec<_> = spending.input[1].witness.to_vec(); witness[0][10] = 42; spending.input[1].witness = Witness::from_slice(&witness); - match spending + + let error = spending .verify(|point: &OutPoint| { if let Some(tx) = spent3.remove(&point.txid) { return tx.output.get(point.vout as usize).cloned(); @@ -1937,8 +1938,9 @@ mod tests { None }) .err() - .unwrap() - { + .unwrap(); + + match error { TxVerifyError::ScriptVerification(_) => {} _ => panic!("Wrong error type"), } From 504f77adcaabc8ca5fef36927e21892018c1bf87 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Tue, 19 Dec 2023 16:59:34 +0000 Subject: [PATCH 3/3] ci: revert #2301 "update download-artifact to v4" --- .github/workflows/fuzz.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index afdd271d..865f7c92 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -69,7 +69,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v3 - name: Display structure of downloaded files run: ls -R - run: find executed_* -type f -exec cat {} + | sort > executed