Remove unused variables and methods from docs

Examples in documentation are not linted in the same way as other code,
but should still contain correctly written code.

Throughout the bitcoin crate unused variables have either been prefixed
with _ or an assert used.  And unused methods have been used in the
example code.
This commit is contained in:
Jamil Lambert, PhD 2024-09-16 17:11:04 +01:00
parent e58cda6f92
commit ff6b1d4f19
No known key found for this signature in database
GPG Key ID: 54DC29234AB5D2C0
3 changed files with 9 additions and 7 deletions

View File

@ -288,14 +288,14 @@ pub enum AddressData {
///
/// // variant 1
/// let address: Address<NetworkUnchecked> = "32iVBEu4dxkUQk9dJbZUiBiQdmypcEyJRf".parse().unwrap();
/// let address: Address<NetworkChecked> = address.require_network(Network::Bitcoin).unwrap();
/// let _address: Address<NetworkChecked> = address.require_network(Network::Bitcoin).unwrap();
///
/// // variant 2
/// let address: Address = Address::from_str("32iVBEu4dxkUQk9dJbZUiBiQdmypcEyJRf").unwrap()
/// let _address: Address = Address::from_str("32iVBEu4dxkUQk9dJbZUiBiQdmypcEyJRf").unwrap()
/// .require_network(Network::Bitcoin).unwrap();
///
/// // variant 3
/// let address: Address<NetworkChecked> = "32iVBEu4dxkUQk9dJbZUiBiQdmypcEyJRf".parse::<Address<_>>()
/// let _address: Address<NetworkChecked> = "32iVBEu4dxkUQk9dJbZUiBiQdmypcEyJRf".parse::<Address<_>>()
/// .unwrap().require_network(Network::Bitcoin).unwrap();
/// ```
///

View File

@ -61,6 +61,8 @@
//! # let _ = target.difficulty(signet);
//! #
//! # let custom = CustomParams::new();
//! # let _ = custom.magic();
//! # let _ = custom.challenge_script();
//! # let _ = target.difficulty(custom);
//! # }
//! ```

View File

@ -144,8 +144,8 @@ pub struct Input {
/// use bitcoin::{EcdsaSighashType, TapSighashType};
/// use bitcoin::psbt::PsbtSighashType;
///
/// let ecdsa_sighash_all: PsbtSighashType = EcdsaSighashType::All.into();
/// let tap_sighash_all: PsbtSighashType = TapSighashType::All.into();
/// let _ecdsa_sighash_all: PsbtSighashType = EcdsaSighashType::All.into();
/// let _tap_sighash_all: PsbtSighashType = TapSighashType::All.into();
/// ```
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
@ -208,8 +208,8 @@ impl PsbtSighashType {
/// ```
/// use bitcoin::{EcdsaSighashType, TapSighashType};
/// use bitcoin::psbt::PsbtSighashType;
/// let ecdsa_sighash_anyone_can_pay: PsbtSighashType = EcdsaSighashType::AllPlusAnyoneCanPay.into();
/// let tap_sighash_anyone_can_pay: PsbtSighashType = TapSighashType::AllPlusAnyoneCanPay.into();
/// let _ecdsa_sighash_anyone_can_pay: PsbtSighashType = EcdsaSighashType::AllPlusAnyoneCanPay.into();
/// let _tap_sighash_anyone_can_pay: PsbtSighashType = TapSighashType::AllPlusAnyoneCanPay.into();
/// ```
pub const ALL: PsbtSighashType = PsbtSighashType { inner: 0x01 };