Skip to content

Commit ae79633

Browse files
committed
clippy: introduce nightly-version and fix all clippy issues with it
Copy nightly-version from rust-elements. The next commit will use it in Github CI. I won't bother making a cronjob for it because this crate is so unused that it doesn't seem worthwhile opening constant PRs for CI updates. We will try to do this manually every several months, or add a cronjob if/when this becomes used. I added an #[allow(unused)] tag on the elementsd test crate. Maybe this trait is actually unused and should be deleted. But the elementsd tests are old and bitrotted and I'd prefer to avoid touching them for purposes of this PR. This commit also introduces a lockfile. Basically, from this commit onward I want my local CI to pass, so I am throwing in several things at once.
1 parent ffc3ea0 commit ae79633

File tree

13 files changed

+1048
-17
lines changed

13 files changed

+1048
-17
lines changed

Cargo-latest.lock

Lines changed: 1029 additions & 0 deletions
Large diffs are not rendered by default.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ keywords = [ "crypto", "bitcoin", "miniscript", "script" ]
99
readme = "README.md"
1010
homepage = "https://github.com/rust-bitcoin/rust-miniscript/"
1111
edition = "2018"
12+
rust-version = "1.63.0"
1213

1314
[features]
1415
compiler = []
@@ -61,3 +62,6 @@ required-features = ["base64"]
6162

6263
[workspace]
6364
members = ["bitcoind-tests", "fuzz"]
65+
66+
[lints.rust]
67+
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(miniscript_bench)'] }

bitcoind-tests/tests/setup/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub fn setup(validate_pegin: bool) -> (ElementsD, Option<BitcoinD>, elements::Bl
6060
(elementsd, bitcoind, genesis_hash)
6161
}
6262
// Upstream all common methods later
63+
#[allow(unused)]
6364
pub trait Call {
6465
fn call(&self, cmd: &str, args: &[Value]) -> Value;
6566
fn get_new_address(&self) -> elements::Address;

bitcoind-tests/tests/test_desc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ fn find_sks_ms<Ctx: ScriptContext>(
322322
.iter_pk()
323323
.filter_map(|pk| {
324324
let i = pks.iter().position(|&x| x.to_public_key() == pk);
325-
i.map(|idx| (sks[idx]))
325+
i.map(|idx| sks[idx])
326326
})
327327
.collect();
328328
sks

clippy.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
msrv = "1.63.0"
2+
# PSBT API returns Self as an error type for an large-ish enum
3+
large-error-threshold = 289

nightly-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nightly-2025-08-19

src/descriptor/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ impl<K: InnerXKey> DescriptorXKey<K> {
969969
if &compare_fingerprint == fingerprint
970970
&& compare_path
971971
.into_iter()
972-
.eq(path_excluding_wildcard.into_iter())
972+
.eq(&path_excluding_wildcard)
973973
{
974974
Some(path_excluding_wildcard)
975975
} else {

src/descriptor/pegin/dynafed_pegin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl Pegin<DescriptorPublicKey> {
6969
secp: &secp256k1_zkp::Secp256k1<C>,
7070
) -> Result<Pegin<PublicKey>, Error> {
7171
let elem_desc = self.elem_desc.at_derivation_index(arg)?;
72-
let elem_desc = elem_desc.derived_descriptor(&secp)?;
72+
let elem_desc = elem_desc.derived_descriptor(secp)?;
7373
Ok(Pegin::new(self.fed_desc.clone(), elem_desc))
7474
}
7575
}
@@ -172,7 +172,7 @@ impl<Pk: MiniscriptKey> Pegin<Pk> {
172172
.expect("DO this cleanly after TR. Pay to taproot pegins unspecified till now"),
173173
network,
174174
)),
175-
_ => return Err(Error::UnsupportedAddressForPegin),
175+
_ => Err(Error::UnsupportedAddressForPegin),
176176
}
177177
}
178178

src/miniscript/analyzable.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ use crate::{error, Extension, Miniscript, MiniscriptKey, ScriptContext, Terminal
1616
///
1717
/// This allows parsing miniscripts if
1818
/// 1. It is unsafe(does not require a digital signature to spend it)
19-
/// 2. It contains a unspendable path because of either
20-
/// a. Resource limitations
21-
/// b. Timelock Mixing
19+
/// 2. It contains a unspendable path because of either resource limitations or timelock mixing.
2220
/// 3. The script is malleable and thereby some of satisfaction weight
2321
/// guarantees are not satisfied.
2422
/// 4. It has repeated public keys
@@ -123,9 +121,7 @@ impl ExtParams {
123121

124122
/// We currently mark Miniscript as Non-Analyzable if
125123
/// 1. It is unsafe(does not require a digital signature to spend it)
126-
/// 2. It contains a unspendable path because of either
127-
/// a. Resource limitations
128-
/// b. Timelock Mixing
124+
/// 2. It contains a unspendable path because of either resource limitations or timelock mixing.
129125
/// 3. The script is malleable and thereby some of satisfaction weight
130126
/// guarantees are not satisfied.
131127
/// 4. It has repeated publickeys

src/miniscript/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext, Ext: Extension> PartialOrd
6767
for Miniscript<Pk, Ctx, Ext>
6868
{
6969
fn partial_cmp(&self, other: &Miniscript<Pk, Ctx, Ext>) -> Option<cmp::Ordering> {
70-
Some(self.node.cmp(&other.node))
70+
Some(self.cmp(other))
7171
}
7272
}
7373

0 commit comments

Comments
 (0)