From a852aef4b8a7f7d94a5f906a9448a86bf79a7fed Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 6 May 2025 10:26:00 +0100 Subject: [PATCH 1/2] Remove unused imports in rustdocs There is a lint warning about unused imports in the rustdoc examples. Remove them. --- primitives/src/locktime/relative.rs | 1 - units/src/result.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/primitives/src/locktime/relative.rs b/primitives/src/locktime/relative.rs index 053e883cf..0aea66f85 100644 --- a/primitives/src/locktime/relative.rs +++ b/primitives/src/locktime/relative.rs @@ -225,7 +225,6 @@ impl LockTime { /// # Examples /// /// ```rust - /// # use bitcoin_primitives::locktime::relative::HeightInterval; /// # use bitcoin_primitives::relative::Time; /// # use units::mtp_height::MtpAndHeight; /// # use bitcoin_primitives::BlockHeight; diff --git a/units/src/result.rs b/units/src/result.rs index e3e82021c..0ced0a2db 100644 --- a/units/src/result.rs +++ b/units/src/result.rs @@ -53,7 +53,7 @@ use crate::{Amount, FeeRate, SignedAmount, Weight}; /// In some instances one may wish to differentiate div-by-zero from overflow. /// /// ``` -/// # use bitcoin_units::{amount, Amount, FeeRate, NumOpResult, NumOpError}; +/// # use bitcoin_units::{Amount, FeeRate, NumOpResult, NumOpError}; /// // Two amounts that will be added to calculate the max fee. /// let a = Amount::from_sat(123).expect("valid amount"); /// let b = Amount::from_sat(467).expect("valid amount"); From 52940d4e1216ad5118f7980cb2e6b8b425c61589 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 6 May 2025 10:28:51 +0100 Subject: [PATCH 2/2] Prefix unused variables with _ in rustdocs There is a lint warning about unused variables in the rustdoc examples. Prefix them with an underscore. --- units/src/lib.rs | 2 +- units/src/result.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/units/src/lib.rs b/units/src/lib.rs index 41c33b017..ffc1cf562 100644 --- a/units/src/lib.rs +++ b/units/src/lib.rs @@ -14,7 +14,7 @@ //! // Exactly the same as `use bitcoin::{amount, Amount}`. //! use bitcoin_units::{amount, Amount}; //! -//! let amount = Amount::from_sat(1_000)?; +//! let _amount = Amount::from_sat(1_000)?; //! # Ok::<_, amount::OutOfRangeError>(()) //! ``` diff --git a/units/src/result.rs b/units/src/result.rs index 0ced0a2db..0416388f1 100644 --- a/units/src/result.rs +++ b/units/src/result.rs @@ -39,12 +39,12 @@ use crate::{Amount, FeeRate, SignedAmount, Weight}; /// // /// // For example if the `spend` value comes from the user and the `change` value is later /// // used then overflow here could be an attack vector. -/// let change = (a1 + a2 - spend - fee).into_result().expect("handle this error"); +/// let _change = (a1 + a2 - spend - fee).into_result().expect("handle this error"); /// /// // Or if we control all the values and know they are sane we can just `unwrap`. -/// let change = (a1 + a2 - spend - fee).unwrap(); +/// let _change = (a1 + a2 - spend - fee).unwrap(); /// // `NumOpResult` also implements `expect`. -/// let change = (a1 + a2 - spend - fee).expect("we know values don't overflow"); +/// let _change = (a1 + a2 - spend - fee).expect("we know values don't overflow"); /// # Ok::<_, amount::OutOfRangeError>(()) /// ``` ///