Merge rust-bitcoin/rust-bitcoin#4382: Cleanup witness module

9eaaf114b0 fix(witness): remove explicit type (aagbotemi)
5b572c5976 docs(witness): use constructs instead of creates (aagbotemi)

Pull request description:

  This PR fixes #4379

  - Removed explicit type
  - updated documentation
  - PR is in two seperate patches

ACKs for top commit:
  apoelstra:
    ACK 9eaaf114b0d6afb810cec8e9dac603ecadf64ff4; successfully ran local tests

Tree-SHA512: 65a6ca880c64aa81d83dffbfcd21a0427c874237a606d82ab70f226839adb164c9ee7fd1ecd5d8cee662660efcd1c458c523a27964cd1d00704d40a3bb6a1deb
This commit is contained in:
merge-script 2025-04-24 14:51:02 +00:00
commit 4ad6e80683
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 6 additions and 2 deletions

View File

@ -221,7 +221,7 @@ impl Witness {
Some(&slice[..end])
}
/// Creates a new witness from a list of hex strings.
/// Constructs a new witness from a list of hex strings.
///
/// # Errors
///
@ -232,7 +232,11 @@ impl Witness {
I: IntoIterator<Item = T>,
T: AsRef<str>,
{
let result: Vec<Vec<u8>> = iter.into_iter().map(|hex_str| Vec::from_hex(hex_str.as_ref())).collect::<Result<Vec<_>, _>>()?;
let result = iter
.into_iter()
.map(|hex_str| Vec::from_hex(hex_str.as_ref()))
.collect::<Result<Vec<_>, _>>()?;
Ok(Self::from_slice(&result))
}
}