Repository: rust-bitcoin/rust-bitcoin
Pull request #2798 (2024-05-23 11:20:39)

Standardize rustdoc subheadings
The subheadings in the rustdocs have been standardized according to [./CONTRIBUTING.md](https://github.com/rust-bitcoin/rust-bitcoin/blob/master/CONTRIBUTING.md):
```rust
impl FooBar {
    /// Constructs a `FooBar` from a [`Baz`].
    ///
    /// # Errors
    ///
    /// Returns an error if `Baz` is not ...
    ///
    /// # Panics
    ///
    /// If the `Baz`, converted to a `usize`, is out of bounds.
    pub fn from_baz(baz: Baz) -> Result<Self, Error> {
        ...
    }
}
```

coveralls: ## Pull Request Test Coverage Report for [Build 9207074825](https://coveralls.io/builds/67663052)


### Details

* **0** of **0**   changed or added relevant lines in **0** files are covered.
* **3** unchanged lines in **1** file lost coverage.
* Overall coverage remained the same at **83.323%**

---


|  Files with Coverage Reduction | New Missed Lines | % |
| :-----|--------------|--: |
| [units/src/amount.rs](https://coveralls.io/builds/67663052/source?filename=units%2Fsrc%2Famount.rs#L1056) | 3 | 88.92% |
<!-- | **Total:** | **3** |  | -->

|  Totals | [![Coverage Status](https://coveralls.io/builds/67663052/badge)](https://coveralls.io/builds/67663052) |
| :-- | --: |
| Change from base [Build 9197500103](https://coveralls.io/builds/67648521): |  0.0% |
| Covered Lines: | 19311 |
| Relevant Lines: | 23176 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c12380e3..69156b0b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -136,7 +136,7 @@ grammar fixes.
 
 Pull request merge requirements:
 - all CI test should pass,
-- at least one "accepts"/ACKs from the repository maintainers
+- at least two "accepts"/ACKs from the repository maintainers (see "refactor carve-out").
 - no reasonable "rejects"/NACKs from anybody who reviewed the code.
 
 Current list of the project maintainers:
@@ -150,6 +150,38 @@ Current list of the project maintainers:
 - [Riccardo Casatta](https://github.com/RCasatta)
 - [Tobin Harding](https://github.com/tcharding)
 
+#### One ACK carve-out
+
+The repository is going through heavy refactoring and "trivial" API redesign
+(eg, rename `Foo::empty` to `Foo::new`) as we push towards API stabilization. As
+such reviewers are either bored or overloaded with notifications, hence we have
+created a carve out to the 2-ACK rule.
+
+We reserve the right to merge PRs with a single ACK [0], at any time, if they match
+any of the following conditions:
+
+0. PR has a single ACK and has sat open for at least two weeks with no comments,
+   questions, or NACKs.
+1. PR only touches CI i.e, only changes any of the test scripts and/or
+   stuff in `.github/workflows`.
+2. Non-content changing documentation fixes i.e., grammar/typos, spelling, full
+   stops, capital letters. Any change with more substance must still get two
+   ACKs.
+3. Code moves that do not change the API e.g., moving error types to a private
+   submodule and re-exporting them from the original module. Must not include
+   any code changes except to import paths. Requires absolutely no change to the
+   public API.
+4. PR has previously had two ACKs, had minimal changes, and gets a single ACK
+   from Andrew. This call is subjective, gives extra privileges, but also
+   requires extra responsibility/accountability (including running a bunch
+   of local CI checks before merging) [1].
+
+
+
+[0] - Obviously author and ACK'er must not be the same person.
+[1] - The aim is to reduce the burden of re-ACK'ing trivial changes and also
+      alleviate the problem of devs spread around the world in different timezones.
+
 #### Backporting
 
 We maintain release branches (e.g. `0.32.x` for the `v0.32` releases).
diff --git a/base58/Cargo.toml b/base58/Cargo.toml
index 681fb032..61fe35a0 100644
--- a/base58/Cargo.toml
+++ b/base58/Cargo.toml
@@ -26,6 +26,3 @@ internals = { package = "bitcoin-internals", version = "0.3.0", features = ["all
 
 [dev-dependencies]
 hex = { package = "hex-conservative", version = "0.2.0", default-features = false, features = ["alloc"] }
-
-[lints.rust]
-unexpected_cfgs = { level = "deny", check-cfg = ['cfg(bench)', 'cfg(fuzzing)', 'cfg(kani)' ] }
diff --git a/bitcoin/Cargo.toml b/bitcoin/Cargo.toml
index f839c72c..1f02b287 100644
--- a/bitcoin/Cargo.toml
+++ b/bitcoin/Cargo.toml
@@ -79,6 +79,3 @@ required-features = ["std", "rand-std", "bitcoinconsensus"]
 
 [[example]]
 name = "sighash"
-
-[lints.rust]
-unexpected_cfgs = { level = "deny", check-cfg = ['cfg(bench)', 'cfg(fuzzing)', 'cfg(kani)', 'cfg(mutate)', 'cfg(rust_v_1_60)'] }
diff --git a/bitcoin/src/bip158.rs b/bitcoin/src/bip158.rs
index a820e997..4d0bc4d3 100644
--- a/bitcoin/src/bip158.rs
+++ b/bitcoin/src/bip158.rs
@@ -480,6 +480,7 @@ pub fn new(reader: &'a mut R) -> BitStreamReader<'a, R> {
     /// Reads nbit bits, returning the bits in a `u64` starting with the rightmost bit.
     ///
     /// # Examples
+    ///
     /// ```
     /// # use bitcoin::bip158::BitStreamReader;
     /// # let data = vec![0xff];
diff --git a/bitcoin/src/blockdata/locktime/absolute.rs b/bitcoin/src/blockdata/locktime/absolute.rs
index 548bf8e3..52669d8a 100644
--- a/bitcoin/src/blockdata/locktime/absolute.rs
+++ b/bitcoin/src/blockdata/locktime/absolute.rs
@@ -45,6 +45,7 @@
 /// * [BIP-113 Median time-past as endpoint for lock-time calculations](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)
 ///
 /// # Examples
+///
 /// ```
 /// # use bitcoin::absolute::{LockTime, LockTime::*};
 /// # let n = LockTime::from_consensus(741521);          // n OP_CHECKLOCKTIMEVERIFY
@@ -61,6 +62,7 @@ pub enum LockTime {
     /// A block height lock time value.
     ///
     /// # Examples
+    ///
     /// ```rust
     /// use bitcoin::absolute::LockTime;
     ///
@@ -73,6 +75,7 @@ pub enum LockTime {
     /// A UNIX timestamp lock time value.
     ///
     /// # Examples
+    ///
     /// ```rust
     /// use bitcoin::absolute::LockTime;
     ///
@@ -141,6 +144,7 @@ pub fn from_consensus(n: u32) -> Self {
     /// See [`LOCK_TIME_THRESHOLD`] for definition of a valid height value.
     ///
     /// # Examples
+    ///
     /// ```rust
     /// # use bitcoin::absolute::LockTime;
     /// assert!(LockTime::from_height(741521).is_ok());
@@ -157,6 +161,7 @@ pub fn from_height(n: u32) -> Result<Self, ConversionError> {
     /// See [`LOCK_TIME_THRESHOLD`] for definition of a valid time value.
     ///
     /// # Examples
+    ///
     /// ```rust
     /// # use bitcoin::absolute::LockTime;
     /// assert!(LockTime::from_time(1653195600).is_ok());
@@ -196,6 +201,7 @@ pub const fn is_block_time(&self) -> bool { !self.is_block_height() }
     /// `height`/`time` is valid.
     ///
     /// # Examples
+    ///
     /// ```no_run
     /// # use bitcoin::absolute::{LockTime, Height, Time};
     /// // Can be implemented if block chain data is available.
diff --git a/bitcoin/src/blockdata/script/owned.rs b/bitcoin/src/blockdata/script/owned.rs
index d7189488..e8558929 100644
--- a/bitcoin/src/blockdata/script/owned.rs
+++ b/bitcoin/src/blockdata/script/owned.rs
@@ -241,7 +241,7 @@ pub(in crate::blockdata::script) fn reserved_len_for_slice(len: usize) -> usize
 
     /// 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 5b066711..1488ebb8 100644
--- a/bitcoin/src/blockdata/script/push_bytes.rs
+++ b/bitcoin/src/blockdata/script/push_bytes.rs
@@ -46,7 +46,7 @@ fn check_limit(len: usize) -> Result<(), PushBytesError> {
     impl PushBytes {
         /// Creates `&Self` without checking the length.
         ///
-        /// ## Safety
+        /// # Safety
         ///
         /// The caller is responsible for checking that the length is less than the [`LIMIT`].
         unsafe fn from_slice_unchecked(bytes: &[u8]) -> &Self {
@@ -55,7 +55,7 @@ unsafe fn from_slice_unchecked(bytes: &[u8]) -> &Self {
 
         /// Creates `&mut Self` without checking the length.
         ///
-        /// ## Safety
+        /// # Safety
         ///
         /// The caller is responsible for checking that the length is less than the [`LIMIT`].
         unsafe fn from_mut_slice_unchecked(bytes: &mut [u8]) -> &mut Self {
@@ -207,7 +207,7 @@ pub fn reserve(&mut self, additional_capacity: usize) {
 
         /// Try pushing a single byte.
         ///
-        /// ## Errors
+        /// # Errors
         ///
         /// This method fails if `self` would exceed the limit.
         #[allow(deprecated)]
@@ -220,7 +220,7 @@ pub fn push(&mut self, byte: u8) -> Result<(), PushBytesError> {
 
         /// Try appending a slice to `PushBytesBuf`
         ///
-        /// ## Errors
+        /// # Errors
         ///
         /// This method fails if `self` would exceed the limit.
         pub fn extend_from_slice(&mut self, bytes: &[u8]) -> Result<(), PushBytesError> {
@@ -235,7 +235,7 @@ pub fn pop(&mut self) -> Option<u8> { self.0.pop() }
 
         /// 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/consensus/validation.rs b/bitcoin/src/consensus/validation.rs
index 32b5d5d0..c5926ee9 100644
--- a/bitcoin/src/consensus/validation.rs
+++ b/bitcoin/src/consensus/validation.rs
@@ -21,6 +21,7 @@
 /// [`bitcoinconsensus::VERIFY_ALL`].
 ///
 /// # Parameters
+///
 ///  * `index` - The input index in spending which is spending this transaction.
 ///  * `amount` - The amount this script guards.
 ///  * `spending_tx` - The transaction that attempts to spend the output holding this script.
@@ -38,6 +39,7 @@ pub fn verify_script(
 /// Verifies spend of an input script.
 ///
 /// # Parameters
+///
 ///  * `index` - The input index in spending which is spending this transaction.
 ///  * `amount` - The amount this script guards.
 ///  * `spending_tx` - The transaction that attempts to spend the output holding this script.
@@ -112,6 +114,7 @@ impl Script {
     /// Shorthand for [`Self::verify_with_flags`] with flag [`bitcoinconsensus::VERIFY_ALL`].
     ///
     /// # Parameters
+    ///
     ///  * `index` - The input index in spending which is spending this transaction.
     ///  * `amount` - The amount this script guards.
     ///  * `spending_tx` - The transaction that attempts to spend the output holding this script.
@@ -129,6 +132,7 @@ pub fn verify(
     /// Verifies spend of an input script.
     ///
     /// # Parameters
+    ///
     ///  * `index` - The input index in spending which is spending this transaction.
     ///  * `amount` - The amount this script guards.
     ///  * `spending_tx` - The transaction that attempts to spend the output holding this script.
diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs
index 951d62b7..679ba8a0 100644
--- a/bitcoin/src/crypto/key.rs
+++ b/bitcoin/src/crypto/key.rs
@@ -710,6 +710,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0
 /// Tweaked BIP-340 key pair
 ///
 /// # Examples
+///
 /// ```
 /// # #[cfg(feature = "rand-std")] {
 /// # use bitcoin::key::{Keypair, TweakedKeypair, TweakedPublicKey};
@@ -746,6 +747,7 @@ pub trait TapTweak {
     ///  * G is the generator point
     ///
     /// # Returns
+    ///
     /// The tweaked key and its parity.
     fn tap_tweak<C: Verification>(
         self,
@@ -775,6 +777,7 @@ impl TapTweak for UntweakedPublicKey {
     ///  * G is the generator point
     ///
     /// # Returns
+    ///
     /// The tweaked key and its parity.
     fn tap_tweak<C: Verification>(
         self,
@@ -806,6 +809,7 @@ impl TapTweak for UntweakedKeypair {
     /// The public key is generated from a private key by multiplying with generator point, Q = qG.
     ///
     /// # Returns
+    ///
     /// The tweaked key and its parity.
     fn tap_tweak<C: Verification>(
         self,
@@ -1521,12 +1525,12 @@ fn private_key_debug_is_obfuscated() {
     }
 
     #[test]
-    #[cfg(not(feature = "std"))]
+    #[cfg(all(not(feature = "std"), feature = "no-std"))]
     fn private_key_debug_is_obfuscated() {
         let sk =
             PrivateKey::from_str("cVt4o7BGAig1UXywgGSmARhxMdzP5qvQsxKkSsc1XEkw3tDTQFpy").unwrap();
         // Why is this not shortened? In rust-secp256k1/src/secret it is printed with "#{:016x}"?
-        let want = "PrivateKey { compressed: true, network: Test, inner: SecretKey(#7217ac58fbad8880a91032107b82cb6c5422544b426c350ee005cf509f3dbf7b) }";
+        let want = "PrivateKey { compressed: true, network: Testnet, inner: SecretKey(#7217ac58fbad8880a91032107b82cb6c5422544b426c350ee005cf509f3dbf7b) }";
         let got = format!("{:?}", sk);
         assert_eq!(got, want)
     }
diff --git a/bitcoin/src/merkle_tree/block.rs b/bitcoin/src/merkle_tree/block.rs
index 59c64969..3639f6a3 100644
--- a/bitcoin/src/merkle_tree/block.rs
+++ b/bitcoin/src/merkle_tree/block.rs
@@ -216,6 +216,8 @@ pub fn hashes(&self) -> &Vec<TxMerkleNode> { &self.hashes }
     /// 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/merkle_tree/mod.rs b/bitcoin/src/merkle_tree/mod.rs
index d26a27a8..d91a81e4 100644
--- a/bitcoin/src/merkle_tree/mod.rs
+++ b/bitcoin/src/merkle_tree/mod.rs
@@ -35,6 +35,7 @@
 /// this method and should not be used again afterwards).
 ///
 /// # Returns
+///
 /// - `None` if `hashes` is empty. The merkle root of an empty tree of hashes is undefined.
 /// - `Some(hash)` if `hashes` contains one element. A single hash is by definition the merkle root.
 /// - `Some(merkle_root)` if length of `hashes` is greater than one.
@@ -53,6 +54,7 @@ pub fn calculate_root_inline<T>(hashes: &mut [T]) -> Option<T>
 /// Calculates the merkle root of an iterator of *hashes*.
 ///
 /// # Returns
+///
 /// - `None` if `hashes` is empty. The merkle root of an empty tree of hashes is undefined.
 /// - `Some(hash)` if `hashes` contains one element. A single hash is by definition the merkle root.
 /// - `Some(merkle_root)` if length of `hashes` is greater than one.
diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs
index bdfb6257..86f1f9b4 100644
--- a/bitcoin/src/psbt/mod.rs
+++ b/bitcoin/src/psbt/mod.rs
@@ -67,11 +67,11 @@ impl Psbt {
     /// For each PSBT input that contains UTXO information `Ok` is returned containing that information.
     /// The order of returned items is same as the order of inputs.
     ///
-    /// ## Errors
+    /// # Errors
     ///
     /// 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<Item = Result<&TxOut, Error>> {
@@ -140,7 +140,7 @@ pub fn extract_tx(self) -> Result<Transaction, ExtractTxError> {
 
     /// Extracts the [`Transaction`] from a [`Psbt`] by filling in the available signature information.
     ///
-    /// ## Errors
+    /// # Errors
     ///
     /// [`ExtractTxError`] variants will contain either the [`Psbt`] itself or the [`Transaction`]
     /// that was extracted. These can be extracted from the Errors in order to recover.
@@ -151,7 +151,7 @@ pub fn extract_tx_fee_rate_limit(self) -> Result<Transaction, ExtractTxError> {
 
     /// Extracts the [`Transaction`] from a [`Psbt`] by filling in the available signature information.
     ///
-    /// ## Errors
+    /// # Errors
     ///
     /// See [`extract_tx`].
     ///
@@ -703,7 +703,7 @@ fn output_type(&self, input_index: usize) -> Result<OutputType, SignError> {
     /// 'Fee' being the amount that will be paid for mining a transaction with the current inputs
     /// and outputs i.e., the difference in value of the total inputs and the total outputs.
     ///
-    /// ## Errors
+    /// # Errors
     ///
     /// - [`Error::MissingUtxo`] when UTXO information for any input is not present or is invalid.
     /// - [`Error::NegativeFee`] if calculated value is negative.
@@ -739,6 +739,7 @@ pub trait GetKey {
     /// Attempts to get the private key for `key_request`.
     ///
     /// # Returns
+    ///
     /// - `Some(key)` if the key is found.
     /// - `None` if the key was not found but no error was encountered.
     /// - `Err` if an error was encountered while looking for the key.
diff --git a/bitcoin/src/psbt/raw.rs b/bitcoin/src/psbt/raw.rs
index 65b350b3..e782ca72 100644
--- a/bitcoin/src/psbt/raw.rs
+++ b/bitcoin/src/psbt/raw.rs
@@ -188,6 +188,7 @@ impl<Subtype> TryFrom<Key> for ProprietaryKey<Subtype>
     /// Constructs a [`ProprietaryKey`] from a [`Key`].
     ///
     /// # Errors
+    ///
     /// Returns [`Error::InvalidProprietaryKey`] if `key` does not start with `0xFC` byte.
     fn try_from(key: Key) -> Result<Self, Self::Error> {
         if key.type_value != 0xFC {
diff --git a/bitcoin/src/taproot/merkle_branch.rs b/bitcoin/src/taproot/merkle_branch.rs
index 79d6e36b..0e573266 100644
--- a/bitcoin/src/taproot/merkle_branch.rs
+++ b/bitcoin/src/taproot/merkle_branch.rs
@@ -66,6 +66,7 @@ pub fn decode(sl: &[u8]) -> Result<Self, TaprootError> {
     /// Creates a merkle proof from list of hashes.
     ///
     /// # Errors
+    ///
     /// If inner proof length is more than [`TAPROOT_CONTROL_MAX_NODE_COUNT`] (128).
     #[inline]
     fn from_collection<T: AsRef<[TapNodeHash]> + Into<Vec<TapNodeHash>>>(
@@ -123,6 +124,7 @@ impl TryFrom<$from> for TaprootMerkleBranch {
             /// Creates a merkle proof from list of hashes.
             ///
             /// # Errors
+            ///
             /// If inner proof length is more than [`TAPROOT_CONTROL_MAX_NODE_COUNT`] (128).
             #[inline]
             fn try_from(v: $from) -> Result<Self, Self::Error> {
diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs
index cfb843c9..dc3de6e7 100644
--- a/bitcoin/src/taproot/mod.rs
+++ b/bitcoin/src/taproot/mod.rs
@@ -429,8 +429,13 @@ pub fn with_huffman_tree<I>(script_weights: I) -> Result<Self, TaprootBuilderErr
         Ok(TaprootBuilder { branch: vec![Some(node)] })
     }
 
-    /// Adds a leaf script at `depth` to the builder with script version `ver`. Errors if the leaves
-    /// are not provided in DFS walk order. The depth of the root node is 0.
+    /// Adds a leaf script at `depth` to the builder with script version `ver`.
+    ///
+    /// The depth of the root node is 0.
+    ///
+    /// # Errors
+    ///
+    /// Errors if the leaves are not provided in DFS walk order.
     pub fn add_leaf_with_ver(
         self,
         depth: u8,
@@ -441,16 +446,26 @@ pub fn add_leaf_with_ver(
         self.insert(leaf, depth)
     }
 
-    /// Adds a leaf script at `depth` to the builder with default script version. Errors if the
-    /// leaves are not provided in DFS walk order. The depth of the root node is 0.
+    /// Adds a leaf script at `depth` to the builder with default script version.
+    ///
+    /// The depth of the root node is 0.
     ///
     /// See [`TaprootBuilder::add_leaf_with_ver`] for adding a leaf with specific version.
+    ///
+    /// # Errors
+    ///
+    /// Errors if the leaves are not provided in DFS walk order.
     pub fn add_leaf(self, depth: u8, script: ScriptBuf) -> Result<Self, TaprootBuilderError> {
         self.add_leaf_with_ver(depth, script, LeafVersion::TapScript)
     }
 
-    /// Adds a hidden/omitted node at `depth` to the builder. Errors if the leaves are not provided
-    /// in DFS walk order. The depth of the root node is 0.
+    /// Adds a hidden/omitted node at `depth` to the builder.
+    ///
+    /// The depth of the root node is 0.
+    ///
+    /// # Errors
+    ///
+    /// Errors if the leaves are not provided in DFS walk order.
     pub fn add_hidden_node(
         self,
         depth: u8,
diff --git a/bitcoin/src/taproot/serialized_signature.rs b/bitcoin/src/taproot/serialized_signature.rs
index 4def2e57..290a16da 100644
--- a/bitcoin/src/taproot/serialized_signature.rs
+++ b/bitcoin/src/taproot/serialized_signature.rs
@@ -133,7 +133,7 @@ fn try_from(value: &'a SerializedSignature) -> Result<Self, Self::Error> {
 impl SerializedSignature {
     /// Creates `SerializedSignature` from data and length.
     ///
-    /// ## Panics
+    /// # Panics
     ///
     /// If `len` > `MAX_LEN`
     #[inline]
diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
index f76d6189..3f162df7 100644
--- a/fuzz/Cargo.toml
+++ b/fuzz/Cargo.toml
@@ -88,6 +88,3 @@ path = "fuzz_targets/hashes/sha512.rs"
 [[bin]]
 name = "units_deserialize_amount"
 path = "fuzz_targets/units/deserialize_amount.rs"
-
-[lints.rust]
-unexpected_cfgs = { level = "deny", check-cfg = ['cfg(fuzzing)'] }
diff --git a/hashes/Cargo.toml b/hashes/Cargo.toml
index 1368c8ee..6538379b 100644
--- a/hashes/Cargo.toml
+++ b/hashes/Cargo.toml
@@ -36,6 +36,3 @@ serde = { version = "1.0", default-features = false, optional = true }
 [dev-dependencies]
 serde_test = "1.0"
 serde_json = "1.0"
-
-[lints.rust]
-unexpected_cfgs = { level = "deny", check-cfg = ['cfg(bench)', 'cfg(hashes_fuzz)', 'cfg(rust_v_1_64)' ] }
diff --git a/internals/Cargo.toml b/internals/Cargo.toml
index 9f8f3d5e..ca6d81be 100644
--- a/internals/Cargo.toml
+++ b/internals/Cargo.toml
@@ -26,6 +26,3 @@ rustdoc-args = ["--cfg", "docsrs"]
 serde = { version = "1.0.103", default-features = false, optional = true }
 
 [dev-dependencies]
-
-[lints.rust]
-unexpected_cfgs = { level = "deny", check-cfg = ['cfg(rust_v_1_64)', 'cfg(rust_v_1_61)'] }
diff --git a/internals/src/macros.rs b/internals/src/macros.rs
index 715f9cb7..4478c354 100644
--- a/internals/src/macros.rs
+++ b/internals/src/macros.rs
@@ -122,7 +122,7 @@ macro_rules! const_assert {
 ///
 /// Note: Paths are not supported (for ex. impl_from_infallible!(Hello<D: std::fmt::Display>).
 ///
-/// ## Examples
+/// # Examples
 ///
 /// ```rust
 /// # use core::fmt::{Display, Debug};
diff --git a/io/Cargo.toml b/io/Cargo.toml
index 3369d1f9..ce3a71a4 100644
--- a/io/Cargo.toml
+++ b/io/Cargo.toml
@@ -21,6 +21,3 @@ alloc = []
 [package.metadata.docs.rs]
 all-features = true
 rustdoc-args = ["--cfg", "docsrs"]
-
-[lints.rust]
-unexpected_cfgs = { level = "deny" }
diff --git a/nightly-version b/nightly-version
index 3cd76cdc..e70649f1 100644
--- a/nightly-version
+++ b/nightly-version
@@ -1,1 +1,1 @@
-nightly-2024-05-21
+nightly-2024-05-04
diff --git a/units/Cargo.toml b/units/Cargo.toml
index afb1ab1a..04fffb94 100644
--- a/units/Cargo.toml
+++ b/units/Cargo.toml
@@ -29,6 +29,3 @@ serde = { version = "1.0.103", default-features = false, features = ["derive"],
 [dev-dependencies]
 serde_test = "1.0"
 serde_json = "1.0"
-
-[lints.rust]
-unexpected_cfgs = { level = "deny", check-cfg = ['cfg(kani)'] }
diff --git a/units/src/amount.rs b/units/src/amount.rs
index a356fb44..98e8216c 100644
--- a/units/src/amount.rs
+++ b/units/src/amount.rs
@@ -21,6 +21,7 @@
 /// A set of denominations in which amounts can be expressed.
 ///
 /// # Examples
+///
 /// ```
 /// # use core::str::FromStr;
 /// # use bitcoin_units::Amount;
@@ -886,7 +887,7 @@ pub fn from_btc(btc: f64) -> Result<Amount, ParseAmountError> {
     /// 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.
@@ -939,6 +940,7 @@ pub fn to_float_in(self, denom: Denomination) -> f64 {
     /// Please be aware of the risk of using floating-point numbers.
     ///
     /// # Examples
+    ///
     /// ```
     /// # use bitcoin_units::amount::{Amount, Denomination};
     /// let amount = Amount::from_sat(100_000);
@@ -1046,12 +1048,20 @@ pub fn checked_rem(self, rhs: u64) -> Option<Amount> { self.0.checked_rem(rhs).m
 
     /// 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 +1444,20 @@ pub fn checked_rem(self, rhs: i64) -> Option<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.
diff --git a/units/src/locktime/absolute.rs b/units/src/locktime/absolute.rs
index f786c0b6..49e1499d 100644
--- a/units/src/locktime/absolute.rs
+++ b/units/src/locktime/absolute.rs
@@ -51,6 +51,7 @@ pub fn from_hex(s: &str) -> Result<Self, ParseHeightError> {
     /// If `n` does not represent a valid block height value.
     ///
     /// # Examples
+    ///
     /// ```rust
     /// use bitcoin_units::locktime::absolute::Height;
     ///
@@ -146,6 +147,7 @@ pub fn from_hex(s: &str) -> Result<Self, ParseTimeError> { parse_hex(s, Self::fr
     /// If `n` does not encode a valid UNIX time stamp.
     ///
     /// # Examples
+    ///
     /// ```rust
     /// use bitcoin_units::locktime::absolute::Time;
     ///


Test patch:
diff --git a/hashes/tests/regression.rs b/hashes/tests/regression.rs
deleted file mode 100644
index eba7f308..00000000
--- a/hashes/tests/regression.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-//! Regression tests for each hash type.
-
-use bitcoin_hashes::{
-    hash160, ripemd160, sha1, sha256, sha256d, sha256t, sha384, sha512, sha512_256, siphash24,
-    Hash as _, Hmac, HmacEngine, HashEngine as _,
-};
-
-const DATA: &str = "arbitrary data to hash as a regression test";
-const HMAC_KEY: &[u8] = b"some key";
-
-macro_rules! impl_regression_test {
-    ($($test_name:ident, $module:ident, $want:literal);* $(;)?) => {
-        $(
-            #[test]
-            fn $test_name() {
-                let hash = $module::Hash::hash(DATA.as_bytes());
-                let got = format!("{}", hash);
-                assert_eq!(got, $want);
-            }
-        )*
-    }
-}
-
-impl_regression_test! {
-    regression_hash160, hash160, "a17909f6d5373b0085c4180ba207126e5040f74d";
-    regression_ripemd160, ripemd160, "e6801701c77a1cd85662335258c7869631b4a9a8";
-    regression_sha1, sha1, "e1e81eeabadafa3d5d41cc3f405385426b0f47fd";
-    regression_sha256, sha256, "d291c6c5a07fa1d9315cdae090ebe14169fbe0a219cd55a48d0d2104eab6ec51";
-    regression_sha256d, sha256d, "93a743b022290bde3233a619b21aaebe06c5cf5cc959464c41be35711e37731b";
-    regression_sha384, sha384, "f545bd83d297978d47a7f26b858a54188499dfb4d7d570a6a2362c765031d57a29d7e002df5e34d184e70b65a4f47153";
-    regression_sha512, sha512, "057d0a37e9e0ac9a93acde0752748da059a27bcf946c7af00692ac1a95db8d21f965f40af22efc4710f100f8d3e43f79f77b1f48e1e400a95b7344b7bc0dfd10";
-    regression_sha512_256, sha512_256, "e204244c429b5bca037a2a8a6e7ed8a42b808ceaff182560840bb8c5c8e9a2ec";
-    regression_siphash24, siphash24, "e823ed82311d601a";
-}
-
-#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
-pub struct RegHashTag;
-
-impl sha256t::Tag for RegHashTag {
-    fn engine() -> sha256::HashEngine {
-        let midstate = sha256::Midstate::from_byte_array([0xab; 32]);
-        sha256::HashEngine::from_midstate(midstate, 64)
-    }
-}
-
-type RegHash = sha256t::Hash<RegHashTag>;
-
-#[test]
-fn regression_sha256t() {
-    let hash = RegHash::hash(DATA.as_bytes());
-    let got = format!("{}", hash);
-    let want = "17db326d7c13867376ccca1f8a211377be3cbeaeb372f167822284866ddf14ca";
-    assert_eq!(got, want);
-}
-
-#[test]
-fn regression_hmac_sha256_with_default_key() {
-    let hash = Hmac::<sha256::Hash>::hash(DATA.as_bytes());
-    let got = format!("{}", hash);
-    let want = "58cc7ed8567bd86eba61f7ed2d5a4edab1774dc10488e57de2eb007a2d9ae82d";
-    assert_eq!(got, want);
-}
-
-#[test]
-fn regression_hmac_sha512_with_default_key() {
-    let hash = Hmac::<sha512::Hash>::hash(DATA.as_bytes());
-    let got = format!("{}", hash);
-    let want = "5f5db2f3e1178bf19af5db38a0ed04dc5bc52d641648542886eea9b6bbec0db658ed7a5799ca18f5bc1949f39d24151a32990ee85974e40bb8a35e2288f494ce";
-    assert_eq!(got, want);
-}
-
-#[test]
-fn regression_hmac_sha256_with_key() {
-    let mut engine = HmacEngine::<sha256::Hash>::new(HMAC_KEY);
-    engine.input(DATA.as_bytes());
-    let hash = Hmac::from_engine(engine);
-
-    let got = format!("{}", hash);
-    let want = "d159cecaf4adf90b6a641bab767e4817d3a51c414acea3682686c35ec0b37b52";
-    assert_eq!(got, want);
-}
-
-#[test]
-fn regression_hmac_sha512_with_key() {
-    let mut engine = HmacEngine::<sha512::Hash>::new(HMAC_KEY);
-    engine.input(DATA.as_bytes());
-    let hash = Hmac::from_engine(engine);
-
-    let got = format!("{}", hash);
-    let want = "8511773748f89ba22c07fb3a2981a12c1823695119de41f4a62aead6b848bd34939acf16475c35ed7956114fead3e794cc162ecd35e447a4dabc3227d55f757b";
-    assert_eq!(got, want);
-}