Merge rust-bitcoin/rust-bitcoin#3722: clippy: Set avoid-breaking-exported-api to false
adaf4ac086
Set avoid-breaking-exported-api to false (Tobin C. Harding)
Pull request description:
These lints are valuable, lets get at em.
ACKs for top commit:
apoelstra:
ACK adaf4ac086553674803fadfde776d6dd013a7964; successfully ran local tests; will probably be a problem repeatedly for the next few days until we get through all currently-open PRs
Tree-SHA512: 56617a2f4aeafceef72008232cee817d45b62c040d7f1938631291c5d73627851cfbefc4b4000cd380ecb5c7e1379d1022f6cc90a4b68c819c78fb883bee0b3a
This commit is contained in:
commit
33f6d028ab
|
@ -605,8 +605,8 @@ impl Xpriv {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a new extended public key from this extended private key.
|
/// Constructs a new extended public key from this extended private key.
|
||||||
pub fn to_xpub<C: secp256k1::Signing>(&self, secp: &Secp256k1<C>) -> Xpub {
|
pub fn to_xpub<C: secp256k1::Signing>(self, secp: &Secp256k1<C>) -> Xpub {
|
||||||
Xpub::from_xpriv(secp, self)
|
Xpub::from_xpriv(secp, &self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a new BIP340 keypair for Schnorr signatures and Taproot use matching the internal
|
/// Constructs a new BIP340 keypair for Schnorr signatures and Taproot use matching the internal
|
||||||
|
|
|
@ -327,7 +327,7 @@ impl CompressedPublicKey {
|
||||||
///
|
///
|
||||||
/// Note that this can be used as a sort key to get BIP67-compliant sorting.
|
/// Note that this can be used as a sort key to get BIP67-compliant sorting.
|
||||||
/// That's why this type doesn't have the `to_sort_key` method - it would duplicate this one.
|
/// That's why this type doesn't have the `to_sort_key` method - it would duplicate this one.
|
||||||
pub fn to_bytes(&self) -> [u8; 33] { self.0.serialize() }
|
pub fn to_bytes(self) -> [u8; 33] { self.0.serialize() }
|
||||||
|
|
||||||
/// Deserializes a public key from a slice.
|
/// Deserializes a public key from a slice.
|
||||||
pub fn from_slice(data: &[u8]) -> Result<Self, secp256k1::Error> {
|
pub fn from_slice(data: &[u8]) -> Result<Self, secp256k1::Error> {
|
||||||
|
|
|
@ -1401,6 +1401,7 @@ impl<E> EncodeSigningDataResult<E> {
|
||||||
/// // use the hash from `writer`
|
/// // use the hash from `writer`
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[allow(clippy::wrong_self_convention)] // Consume self so we can take the error.
|
||||||
pub fn is_sighash_single_bug(self) -> Result<bool, E> {
|
pub fn is_sighash_single_bug(self) -> Result<bool, E> {
|
||||||
match self {
|
match self {
|
||||||
EncodeSigningDataResult::SighashSingleBug => Ok(true),
|
EncodeSigningDataResult::SighashSingleBug => Ok(true),
|
||||||
|
|
|
@ -303,7 +303,7 @@ macro_rules! impl_array_newtype {
|
||||||
|
|
||||||
/// Copies the underlying bytes into a new `Vec`.
|
/// Copies the underlying bytes into a new `Vec`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_vec(&self) -> alloc::vec::Vec<u8> { self.0.to_vec() }
|
pub fn to_vec(self) -> alloc::vec::Vec<u8> { self.0.to_vec() }
|
||||||
|
|
||||||
/// Returns a slice of the underlying bytes.
|
/// Returns a slice of the underlying bytes.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -312,7 +312,7 @@ macro_rules! impl_array_newtype {
|
||||||
/// Copies the underlying bytes into a new `Vec`.
|
/// Copies the underlying bytes into a new `Vec`.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[deprecated(since = "TBD", note = "use to_vec instead")]
|
#[deprecated(since = "TBD", note = "use to_vec instead")]
|
||||||
pub fn to_bytes(&self) -> alloc::vec::Vec<u8> { self.to_vec() }
|
pub fn to_bytes(self) -> alloc::vec::Vec<u8> { self.to_vec() }
|
||||||
|
|
||||||
/// Converts the object to a raw pointer.
|
/// Converts the object to a raw pointer.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -155,8 +155,8 @@ impl SerializedSignature {
|
||||||
/// Convert the serialized signature into the Signature struct.
|
/// Convert the serialized signature into the Signature struct.
|
||||||
/// (This deserializes it)
|
/// (This deserializes it)
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_signature(&self) -> Result<Signature, SigFromSliceError> {
|
pub fn to_signature(self) -> Result<Signature, SigFromSliceError> {
|
||||||
Signature::from_slice(self)
|
Signature::from_slice(&self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a new SerializedSignature from a Signature.
|
/// Constructs a new SerializedSignature from a Signature.
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
msrv = "1.63.0"
|
msrv = "1.63.0"
|
||||||
too-many-arguments-threshold = 13
|
too-many-arguments-threshold = 13
|
||||||
|
avoid-breaking-exported-api = false
|
||||||
|
|
|
@ -81,7 +81,7 @@ impl LockTime {
|
||||||
/// Locktimes are not ordered by the natural ordering on `u32`. If you want to
|
/// Locktimes are not ordered by the natural ordering on `u32`. If you want to
|
||||||
/// compare locktimes, use [`Self::is_implied_by`] or similar methods.
|
/// compare locktimes, use [`Self::is_implied_by`] or similar methods.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_consensus_u32(&self) -> u32 {
|
pub fn to_consensus_u32(self) -> u32 {
|
||||||
match self {
|
match self {
|
||||||
LockTime::Blocks(ref h) => h.to_consensus_u32(),
|
LockTime::Blocks(ref h) => h.to_consensus_u32(),
|
||||||
LockTime::Time(ref t) => t.to_consensus_u32(),
|
LockTime::Time(ref t) => t.to_consensus_u32(),
|
||||||
|
@ -99,7 +99,7 @@ impl LockTime {
|
||||||
|
|
||||||
/// Encodes the locktime as a sequence number.
|
/// Encodes the locktime as a sequence number.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_sequence(&self) -> Sequence { Sequence::from_consensus(self.to_consensus_u32()) }
|
pub fn to_sequence(self) -> Sequence { Sequence::from_consensus(self.to_consensus_u32()) }
|
||||||
|
|
||||||
/// Constructs a new `LockTime` from `n`, expecting `n` to be a 16-bit count of blocks.
|
/// Constructs a new `LockTime` from `n`, expecting `n` to be a 16-bit count of blocks.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -184,7 +184,7 @@ impl Sequence {
|
||||||
|
|
||||||
/// Constructs a new [`relative::LockTime`] from this [`Sequence`] number.
|
/// Constructs a new [`relative::LockTime`] from this [`Sequence`] number.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_relative_lock_time(&self) -> Option<relative::LockTime> {
|
pub fn to_relative_lock_time(self) -> Option<relative::LockTime> {
|
||||||
use crate::locktime::relative::{Height, LockTime, Time};
|
use crate::locktime::relative::{Height, LockTime, Time};
|
||||||
|
|
||||||
if !self.is_relative_lock_time() {
|
if !self.is_relative_lock_time() {
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl BlockHeight {
|
||||||
|
|
||||||
/// Returns block height as a `u32`.
|
/// Returns block height as a `u32`.
|
||||||
// Because type inference doesn't always work using `Into`.
|
// Because type inference doesn't always work using `Into`.
|
||||||
pub const fn to_u32(&self) -> u32 { self.0 }
|
pub const fn to_u32(self) -> u32 { self.0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for BlockHeight {
|
impl fmt::Display for BlockHeight {
|
||||||
|
@ -114,7 +114,7 @@ impl BlockInterval {
|
||||||
|
|
||||||
/// Returns block interval as a `u32`.
|
/// Returns block interval as a `u32`.
|
||||||
// Because type inference doesn't always work using `Into`.
|
// Because type inference doesn't always work using `Into`.
|
||||||
pub const fn to_u32(&self) -> u32 { self.0 }
|
pub const fn to_u32(self) -> u32 { self.0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for BlockInterval {
|
impl fmt::Display for BlockInterval {
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl Height {
|
||||||
/// Returns the `u32` value used to encode this locktime in an nSequence field or
|
/// Returns the `u32` value used to encode this locktime in an nSequence field or
|
||||||
/// argument to `OP_CHECKSEQUENCEVERIFY`.
|
/// argument to `OP_CHECKSEQUENCEVERIFY`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_consensus_u32(&self) -> u32 {
|
pub const fn to_consensus_u32(self) -> u32 {
|
||||||
self.0 as u32 // cast safety: u32 is wider than u16 on all architectures
|
self.0 as u32 // cast safety: u32 is wider than u16 on all architectures
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ impl Time {
|
||||||
/// Returns the `u32` value used to encode this locktime in an nSequence field or
|
/// Returns the `u32` value used to encode this locktime in an nSequence field or
|
||||||
/// argument to `OP_CHECKSEQUENCEVERIFY`.
|
/// argument to `OP_CHECKSEQUENCEVERIFY`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn to_consensus_u32(&self) -> u32 {
|
pub const fn to_consensus_u32(self) -> u32 {
|
||||||
(1u32 << 22) | self.0 as u32 // cast safety: u32 is wider than u16 on all architectures
|
(1u32 << 22) | self.0 as u32 // cast safety: u32 is wider than u16 on all architectures
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue