diff --git a/bitcoin/src/blockdata/script/owned.rs b/bitcoin/src/blockdata/script/owned.rs index d7189488c..e8558929b 100644 --- a/bitcoin/src/blockdata/script/owned.rs +++ b/bitcoin/src/blockdata/script/owned.rs @@ -241,7 +241,7 @@ impl ScriptBuf { /// Add a single instruction to the script. /// - /// ## Panics + /// # Panics /// /// The method panics if the instruction is a data push with length greater or equal to /// 0x100000000. diff --git a/bitcoin/src/blockdata/script/push_bytes.rs b/bitcoin/src/blockdata/script/push_bytes.rs index 5b0667113..1b229489a 100644 --- a/bitcoin/src/blockdata/script/push_bytes.rs +++ b/bitcoin/src/blockdata/script/push_bytes.rs @@ -235,7 +235,7 @@ mod primitive { /// Remove the byte at `index` and return it. /// - /// ## Panics + /// # Panics /// /// This method panics if `index` is out of bounds. #[track_caller] diff --git a/bitcoin/src/merkle_tree/block.rs b/bitcoin/src/merkle_tree/block.rs index 59c64969c..3639f6a30 100644 --- a/bitcoin/src/merkle_tree/block.rs +++ b/bitcoin/src/merkle_tree/block.rs @@ -216,6 +216,8 @@ impl PartialMerkleTree { /// The `txids` are the transaction hashes of the block and the `matches` is the contains flags /// wherever a tx hash should be included in the proof. /// + /// # Panics + /// /// Panics when `txids` is empty or when `matches` has a different length /// /// # Examples diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs index bdfb62579..713dc2481 100644 --- a/bitcoin/src/psbt/mod.rs +++ b/bitcoin/src/psbt/mod.rs @@ -71,7 +71,7 @@ impl Psbt { /// /// The function returns error when UTXO information is not present or is invalid. /// - /// ## Panics + /// # Panics /// /// The function panics if the length of transaction inputs is not equal to the length of PSBT inputs. pub fn iter_funding_utxos(&self) -> impl Iterator> { diff --git a/bitcoin/src/taproot/serialized_signature.rs b/bitcoin/src/taproot/serialized_signature.rs index 4def2e578..290a16da7 100644 --- a/bitcoin/src/taproot/serialized_signature.rs +++ b/bitcoin/src/taproot/serialized_signature.rs @@ -133,7 +133,7 @@ impl<'a> TryFrom<&'a SerializedSignature> for Signature { impl SerializedSignature { /// Creates `SerializedSignature` from data and length. /// - /// ## Panics + /// # Panics /// /// If `len` > `MAX_LEN` #[inline] diff --git a/units/src/amount.rs b/units/src/amount.rs index a356fb440..6562585ba 100644 --- a/units/src/amount.rs +++ b/units/src/amount.rs @@ -886,7 +886,7 @@ impl Amount { /// Convert from a value expressing integer values of bitcoins to an [Amount] /// in const context. /// - /// ## Panics + /// # Panics /// /// The function panics if the argument multiplied by the number of sats /// per bitcoin overflows a u64 type. @@ -1046,12 +1046,20 @@ impl Amount { /// Unchecked addition. /// - /// Computes `self + rhs`. Panics in debug mode, wraps in release mode. + /// Computes `self + rhs`. + /// + /// # Panics + /// + /// On overflow, panics in debug mode, wraps in release mode. pub fn unchecked_add(self, rhs: Amount) -> Amount { Self(self.0 + rhs.0) } /// Unchecked subtraction. /// - /// Computes `self - rhs`. Panics in debug mode, wraps in release mode. + /// Computes `self - rhs`. + /// + /// # Panics + /// + /// On overflow, panics in debug mode, wraps in release mode. pub fn unchecked_sub(self, rhs: Amount) -> Amount { Self(self.0 - rhs.0) } /// Convert to a signed amount. @@ -1434,12 +1442,20 @@ impl SignedAmount { /// Unchecked addition. /// - /// Computes `self + rhs`. Panics in debug mode, wraps in release mode. + /// Computes `self + rhs`. + /// + /// # Panics + /// + /// On overflow, panics in debug mode, wraps in release mode. pub fn unchecked_add(self, rhs: SignedAmount) -> SignedAmount { Self(self.0 + rhs.0) } /// Unchecked subtraction. /// - /// Computes `self - rhs`. Panics in debug mode, wraps in release mode. + /// Computes `self - rhs`. + /// + /// # Panics + /// + /// On overflow, panics in debug mode, wraps in release mode. pub fn unchecked_sub(self, rhs: SignedAmount) -> SignedAmount { Self(self.0 - rhs.0) } /// Subtraction that doesn't allow negative [SignedAmount]s.