Skip to content

Commit af2664d

Browse files
committed
Merge #834: 12.x: fix CI
2019e97 ci: pin nightly compiler version (Andrew Poelstra) 22ce32a clippy: non-lifetime stuff (Andrew Poelstra) 9efc345 clippy: lifetime syntax stuff (Andrew Poelstra) 01bfd22 clippy.toml: bump up large error threshold (Andrew Poelstra) d0e59e4 doc: fix broken link and stranded doccomment (Andrew Poelstra) Pull request description: Should get us green CI, and pins the nightly compiler version so that it stays green. ACKs for top commit: sanket1729: utACK 2019e97 Tree-SHA512: 8ea194dabb839b91a3897312334f56cae15735dc131594fadb10c9d8da2759c4e9581142d10e5b67f1136d3e7e67f2f0bd556fdfdbf3b1d246811ecffded26e8
2 parents 9e6d6c5 + 2019e97 commit af2664d

File tree

16 files changed

+50
-47
lines changed

16 files changed

+50
-47
lines changed

.github/workflows/rust.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ on: # yamllint disable-line rule:truthy
99
name: Continuous integration
1010

1111
jobs:
12+
Prepare:
13+
runs-on: ubuntu-24.04
14+
outputs:
15+
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
16+
steps:
17+
- name: "Checkout repo"
18+
uses: actions/checkout@v4
19+
- name: "Read nightly version"
20+
id: read_toolchain
21+
run: echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT
22+
1223
Stable: # 2 jobs, one per lock file.
1324
name: Test - stable toolchain
1425
runs-on: ubuntu-latest
@@ -33,6 +44,7 @@ jobs:
3344

3445
Nightly: # 2 jobs, one per lock file.
3546
name: Test - nightly toolchain
47+
needs: Prepare
3648
runs-on: ubuntu-latest
3749
strategy:
3850
fail-fast: false
@@ -47,7 +59,9 @@ jobs:
4759
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
4860
path: maintainer-tools
4961
- name: "Select toolchain"
50-
uses: dtolnay/rust-toolchain@nightly
62+
uses: dtolnay/rust-toolchain@v1
63+
with:
64+
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
5165
- name: "Set dependencies"
5266
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
5367
- name: "Run test script"
@@ -79,6 +93,7 @@ jobs:
7993

8094
Lint:
8195
name: Lint - nightly toolchain
96+
needs: Prepare
8297
runs-on: ubuntu-latest
8398
strategy:
8499
fail-fast: false
@@ -93,7 +108,9 @@ jobs:
93108
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
94109
path: maintainer-tools
95110
- name: "Select toolchain"
96-
uses: dtolnay/rust-toolchain@nightly
111+
uses: dtolnay/rust-toolchain@v1
112+
with:
113+
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
97114
- name: "Install clippy"
98115
run: rustup component add clippy
99116
- name: "Set dependencies"
@@ -125,6 +142,7 @@ jobs:
125142

126143
Docsrs:
127144
name: Docs - nightly toolchain
145+
needs: Prepare
128146
runs-on: ubuntu-latest
129147
strategy:
130148
fail-fast: false
@@ -139,7 +157,9 @@ jobs:
139157
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
140158
path: maintainer-tools
141159
- name: "Select toolchain"
142-
uses: dtolnay/rust-toolchain@nightly
160+
uses: dtolnay/rust-toolchain@v1
161+
with:
162+
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
143163
- name: "Set dependencies"
144164
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
145165
- name: "Run test script"
@@ -198,6 +218,7 @@ jobs:
198218
run: ./contrib/integration_test.sh
199219

200220
Embedded:
221+
needs: Prepare
201222
runs-on: ubuntu-latest
202223
steps:
203224
- name: Checkout
@@ -208,7 +229,7 @@ jobs:
208229
uses: actions-rs/toolchain@v1
209230
with:
210231
profile: minimal
211-
toolchain: nightly
232+
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
212233
override: true
213234
components: rust-src
214235
target: thumbv7m-none-eabi

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
msrv = "1.56.1"
22
# plan API returns Self as an error type for an large-ish enum
3-
large-error-threshold = 256
3+
large-error-threshold = 512

nightly-version

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

src/descriptor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ impl Descriptor<DescriptorPublicKey> {
648648
/// See [`at_derivation_index`] and `[derived_descriptor`] for more documentation.
649649
///
650650
/// [`at_derivation_index`]: Self::at_derivation_index
651-
/// [`derived_descriptor`]: crate::DerivedDescriptor::derived_descriptor
651+
/// [`derived_descriptor`]: crate::Descriptor::derived_descriptor
652652
///
653653
/// # Errors
654654
///

src/descriptor/tr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<Pk: MiniscriptKey> TapTree<Pk> {
129129

130130
/// Iterates over all miniscripts in DFS walk order compatible with the
131131
/// PSBT requirements (BIP 371).
132-
pub fn iter(&self) -> TapTreeIter<Pk> { TapTreeIter { stack: vec![(0, self)] } }
132+
pub fn iter(&self) -> TapTreeIter<'_, Pk> { TapTreeIter { stack: vec![(0, self)] } }
133133

134134
// Helper function to translate keys
135135
fn translate_helper<T, Q, E>(&self, t: &mut T) -> Result<TapTree<Q>, TranslateErr<E>>
@@ -196,7 +196,7 @@ impl<Pk: MiniscriptKey> Tr<Pk> {
196196

197197
/// Iterate over all scripts in merkle tree. If there is no script path, the iterator
198198
/// yields [`None`]
199-
pub fn iter_scripts(&self) -> TapTreeIter<Pk> {
199+
pub fn iter_scripts(&self) -> TapTreeIter<'_, Pk> {
200200
match self.tree {
201201
Some(ref t) => t.iter(),
202202
None => TapTreeIter { stack: vec![] },
@@ -565,7 +565,7 @@ impl<Pk: MiniscriptKey> fmt::Display for Tr<Pk> {
565565
}
566566

567567
// Helper function to parse string into miniscript tree form
568-
fn parse_tr_tree(s: &str) -> Result<expression::Tree, Error> {
568+
fn parse_tr_tree(s: &str) -> Result<expression::Tree<'_>, Error> {
569569
expression::check_valid_chars(s)?;
570570

571571
if s.len() > 3 && &s[..3] == "tr(" && s.as_bytes()[s.len() - 1] == b')' {

src/iter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub use tree::{
1717
use crate::sync::Arc;
1818
use crate::{Miniscript, MiniscriptKey, ScriptContext, Terminal};
1919

20-
impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> TreeLike for &'a Miniscript<Pk, Ctx> {
20+
impl<Pk: MiniscriptKey, Ctx: ScriptContext> TreeLike for &'_ Miniscript<Pk, Ctx> {
2121
fn as_node(&self) -> Tree<Self> {
2222
use Terminal::*;
2323
match self.node {

src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,6 @@ where
401401
T: Translator<P, Q, E>;
402402
}
403403

404-
/// Either a key or keyhash, but both contain Pk
405-
// pub struct ForEach<'a, Pk: MiniscriptKey>(&'a Pk);
406-
407-
// impl<'a, Pk: MiniscriptKey<Hash = Pk>> ForEach<'a, Pk> {
408-
// /// Convenience method to avoid distinguishing between keys and hashes when these are the same type
409-
// pub fn as_key(&self) -> &'a Pk {
410-
// self.0
411-
// }
412-
// }
413-
414404
/// Trait describing the ability to iterate over every key
415405
pub trait ForEachKey<Pk: MiniscriptKey> {
416406
/// Run a predicate on every key in the descriptor, returning whether

src/miniscript/analyzable.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ use crate::{Miniscript, MiniscriptKey, ScriptContext, Terminal};
1717
///
1818
/// This allows parsing miniscripts if
1919
/// 1. It is unsafe(does not require a digital signature to spend it)
20-
/// 2. It contains a unspendable path because of either
21-
/// a. Resource limitations
22-
/// b. Timelock Mixing
23-
/// 3. The script is malleable and thereby some of satisfaction weight
24-
/// guarantees are not satisfied.
20+
/// 2. It contains a unspendable path because of either resource limitations or timelock mixing.
21+
/// 3. The script is malleable and thereby some of satisfaction weight guarantees are not satisfied.
2522
/// 4. It has repeated public keys
2623
/// 5. raw pkh fragments without the pk. This could be obtained when parsing miniscript from script
2724
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Hash)]
@@ -123,11 +120,8 @@ impl ExtParams {
123120
/// Possible reasons Miniscript guarantees can fail
124121
/// We currently mark Miniscript as Non-Analyzable if
125122
/// 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
129-
/// 3. The script is malleable and thereby some of satisfaction weight
130-
/// guarantees are not satisfied.
123+
/// 2. It contains a unspendable path because of either resource limitations or timelock mixing.
124+
/// 3. The script is malleable and thereby some of satisfaction weight guarantees are not satisfied.
131125
/// 4. It has repeated publickeys
132126
#[derive(Debug, PartialEq)]
133127
pub enum AnalysisError {

src/miniscript/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
1818
/// Creates a new [Iter] iterator that will iterate over all [Miniscript] items within
1919
/// AST by traversing its branches. For the specific algorithm please see
2020
/// [Iter::next] function.
21-
pub fn iter(&self) -> Iter<Pk, Ctx> { Iter::new(self) }
21+
pub fn iter(&self) -> Iter<'_, Pk, Ctx> { Iter::new(self) }
2222

2323
/// Creates a new [PkIter] iterator that will iterate over all plain public keys (and not
2424
/// key hash values) present in [Miniscript] items within AST by traversing all its branches.
2525
/// For the specific algorithm please see [PkIter::next] function.
26-
pub fn iter_pk(&self) -> PkIter<Pk, Ctx> { PkIter::new(self) }
26+
pub fn iter_pk(&self) -> PkIter<'_, Pk, Ctx> { PkIter::new(self) }
2727

2828
/// Enumerates all child nodes of the current AST node (`self`) and returns a `Vec` referencing
2929
/// them.

src/miniscript/lex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'s> TokenIter<'s> {
7575
pub fn new(v: Vec<Token<'s>>) -> TokenIter<'s> { TokenIter(v) }
7676

7777
/// Look at the top at Iterator
78-
pub fn peek(&self) -> Option<&'s Token> { self.0.last() }
78+
pub fn peek(&self) -> Option<&'s Token<'_>> { self.0.last() }
7979

8080
/// Push a value to the iterator
8181
/// This will be first value consumed by popun_

0 commit comments

Comments
 (0)