From 432c49bb7ba422b26618d531ac79fcffc52f58d4 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 3 May 2022 13:19:11 +1000 Subject: [PATCH 1/3] Remove reference to private types The compiler emits various warnings of type: warning: public documentation for ... Remove the docs that include links to private methods and types. --- src/descriptor/key.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/descriptor/key.rs b/src/descriptor/key.rs index ac116d1ec..69ade2f69 100644 --- a/src/descriptor/key.rs +++ b/src/descriptor/key.rs @@ -242,13 +242,10 @@ impl fmt::Display for DescriptorPublicKey { } impl DescriptorSecretKey { - /// Return the public version of this key, by applying either - /// [`SinglePriv::to_public`] or [`DescriptorXKey::to_public`] - /// depending on the type of key. + /// Returns the public version of this key. /// - /// If the key is an "XPrv", the hardened derivation steps will be applied before converting it - /// to a public key. See the documentation of [`DescriptorXKey::to_public`] - /// for more details. + /// If the key is an "XPrv", the hardened derivation steps will be applied + /// before converting it to a public key. pub fn to_public( &self, secp: &Secp256k1, From 3ff4f14c8108b94fa448ac0b04615f1893ab2238 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 3 May 2022 13:29:05 +1000 Subject: [PATCH 2/3] Fix docs links Fix all the docs build warnings for broken links. --- src/descriptor/mod.rs | 6 +++--- src/interpreter/mod.rs | 2 +- src/psbt/mod.rs | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/descriptor/mod.rs b/src/descriptor/mod.rs index 375390e47..06a5247a1 100644 --- a/src/descriptor/mod.rs +++ b/src/descriptor/mod.rs @@ -667,9 +667,9 @@ impl Descriptor { /// Derive a [`Descriptor`] with a concrete [`bitcoin::PublicKey`] at a given index /// Removes all extended pubkeys and wildcards from the descriptor and only leaves - /// concrete [`bitcoin::PublicKey`]. All [`crate::XOnlyKey`]s are converted to [`bitcoin::PublicKey`] - /// by adding a default(0x02) y-coordinate. For [`crate::descriptor::Tr`] descriptor, - /// spend info is also cached. + /// concrete [`bitcoin::PublicKey`]. All [`bitcoin::XOnlyPublicKey`]s are converted + /// to [`bitcoin::PublicKey`]s by adding a default(0x02) y-coordinate. For [`Tr`] + /// descriptor, spend info is also cached. /// /// # Examples /// diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index f46c09254..ce12ed36a 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -217,7 +217,7 @@ impl<'txin> Interpreter<'txin> { } /// Verify a signature for a given transaction and prevout information - /// This is a low level API, [`Interpreter::iter`] or [`Interpreter::iter_assume_sig`] + /// This is a low level API, [`Interpreter::iter`] or [`Interpreter::iter_assume_sigs`] /// should satisfy most use-cases. /// Returns false if /// - the signature verification fails diff --git a/src/psbt/mod.rs b/src/psbt/mod.rs index d1b35ba60..d3a591b12 100644 --- a/src/psbt/mod.rs +++ b/src/psbt/mod.rs @@ -559,8 +559,10 @@ pub trait PsbtExt { /// # Arguments: /// /// * `idx`: The input index of psbt to sign - /// * `cache`: The [`sighash::SighashCache`] for used to cache/read previously cached computations + /// * `cache`: The [`SighashCache`] for used to cache/read previously cached computations /// * `tapleaf_hash`: If the output is taproot, compute the sighash for this particular leaf. + /// + /// [`SighashCache`]: bitcoin::util::sighash::SighashCache fn sighash_msg>( &self, idx: usize, From c40d350dde582ae84bc155c17a1aed37fe37722e Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 3 May 2022 13:33:49 +1000 Subject: [PATCH 3/3] CI: Build the docs Add docs build to the ci script, guard with env var `DO_DOCS` as we do in other crates in the stack. Add a docs build job to the CI configuration using the nightly toolchain as required. --- .github/workflows/rust.yml | 16 ++++++++-------- contrib/test.sh | 7 ++++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2ee7a3a8a..da85fb91c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,13 +27,9 @@ jobs: DO_LINT: true run: ./contrib/test.sh - bench_nightly: - name: Bench + Tests + Nightly: + name: Bench + Docs runs-on: ubuntu-latest - strategy: - matrix: - rust: - - nightly steps: - name: Checkout Crate uses: actions/checkout@v2 @@ -41,12 +37,16 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: ${{ matrix.rust }} + toolchain: nightly override: true - - name: Running cargo test + - name: Running benchmarks env: DO_BENCH: true run: ./contrib/test.sh + - name: Building docs + env: + DO_DOCS: true + run: ./contrib/test.sh UnitTests: name: Tests diff --git a/contrib/test.sh b/contrib/test.sh index 6b5403380..f9fa0b47c 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -44,12 +44,17 @@ cargo build --examples # run all examples run-parts ./target/debug/examples -# Bench if told to +# Bench if told to (this only works with the nightly toolchain) if [ "$DO_BENCH" = true ] then cargo bench --features="unstable compiler" fi +# Build the docs if told to (this only works with the nightly toolchain) +if [ "$DO_DOCS" = true ]; then + RUSTDOCFLAGS="--cfg docsrs" cargo doc --all --features="$FEATURES" +fi + # Run Integration tests if told so if [ -n "$BITCOINVERSION" ]; then set -e