Merge rust-bitcoin/rust-bitcoin#4457: rustdoc: Fix unused lint warnings

52940d4e12 Prefix unused variables with _ in rustdocs (Jamil Lambert, PhD)
a852aef4b8 Remove unused imports in rustdocs (Jamil Lambert, PhD)

Pull request description:

  There is a lint warning about unused variables and imports in the rustdoc examples.

  Remove the unused imports and prefix the unused variables with an underscore.

ACKs for top commit:
  apoelstra:
    ACK 52940d4e1216ad5118f7980cb2e6b8b425c61589; successfully ran local tests
  tcharding:
    ACK 52940d4e12

Tree-SHA512: 953862d546dc6e0bcd64172e8b383f0fc2a1a851971a1bcad0c1e30cbaeeaea993a0de7dd8b424c4ac1410053e179c52d0b5c90cd1b6560c27123b6b7fa49732
This commit is contained in:
merge-script 2025-05-07 18:56:53 +00:00
commit 10657865c3
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 5 additions and 6 deletions

View File

@ -225,7 +225,6 @@ impl LockTime {
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// # use bitcoin_primitives::locktime::relative::HeightInterval;
/// # use bitcoin_primitives::relative::Time; /// # use bitcoin_primitives::relative::Time;
/// # use units::mtp_height::MtpAndHeight; /// # use units::mtp_height::MtpAndHeight;
/// # use bitcoin_primitives::BlockHeight; /// # use bitcoin_primitives::BlockHeight;

View File

@ -14,7 +14,7 @@
//! // Exactly the same as `use bitcoin::{amount, Amount}`. //! // Exactly the same as `use bitcoin::{amount, Amount}`.
//! use bitcoin_units::{amount, Amount}; //! use bitcoin_units::{amount, Amount};
//! //!
//! let amount = Amount::from_sat(1_000)?; //! let _amount = Amount::from_sat(1_000)?;
//! # Ok::<_, amount::OutOfRangeError>(()) //! # Ok::<_, amount::OutOfRangeError>(())
//! ``` //! ```

View File

@ -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 /// // 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. /// // 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`. /// // 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`. /// // `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>(()) /// # Ok::<_, amount::OutOfRangeError>(())
/// ``` /// ```
/// ///
@ -53,7 +53,7 @@ use crate::{Amount, FeeRate, SignedAmount, Weight};
/// In some instances one may wish to differentiate div-by-zero from overflow. /// 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. /// // Two amounts that will be added to calculate the max fee.
/// let a = Amount::from_sat(123).expect("valid amount"); /// let a = Amount::from_sat(123).expect("valid amount");
/// let b = Amount::from_sat(467).expect("valid amount"); /// let b = Amount::from_sat(467).expect("valid amount");