Merge rust-bitcoin/rust-bitcoin#3900: units: Fix `missing_errors_doc` clippy lint

f9be30ddbe units: Fix `missing_errors_doc` clippy lint (Jamil Lambert, PhD)

Pull request description:

  Change the `missing_errors_doc` clippy lint to `warn`.
  Allow `missing_errors_doc` in `amount/serde.rs` and `fee_rate/serde.rs`. Add missing `# Errors` sections to rustdocs where the lint gives a warning.

  One of the TODO lints in Issue https://github.com/rust-bitcoin/rust-bitcoin/issues/3825

ACKs for top commit:
  tcharding:
    ACK f9be30ddbe
  apoelstra:
    ACK f9be30ddbe5c0837ab3e408dfadabc6c6cd2068e; successfully ran local tests

Tree-SHA512: 8039804ab86c18dceadb425c8531cd4064431393367c6053249e00386f48998d8d84a3aee6ad139e7e2ca3ac3c94e05ee694d72270bf285f6b90d0ff821e622e
This commit is contained in:
merge-script 2025-01-16 05:13:28 +00:00
commit 70fc3999ae
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
5 changed files with 20 additions and 3 deletions

View File

@ -105,7 +105,7 @@ match_wild_err_arm = "warn"
match_wildcard_for_single_variants = "warn" match_wildcard_for_single_variants = "warn"
maybe_infinite_iter = "warn" maybe_infinite_iter = "warn"
mismatching_type_param_order = "warn" mismatching_type_param_order = "warn"
missing_errors_doc = "allow" # TODO: Still needs considering. missing_errors_doc = "warn"
missing_fields_in_debug = "warn" missing_fields_in_debug = "warn"
missing_panics_doc = "warn" missing_panics_doc = "warn"
must_use_candidate = "allow" # Useful for audit but many false positives. must_use_candidate = "allow" # Useful for audit but many false positives.

View File

@ -2,6 +2,7 @@
// methods are implementation of a standardized serde-specific signature // methods are implementation of a standardized serde-specific signature
#![allow(missing_docs)] #![allow(missing_docs)]
#![allow(clippy::missing_errors_doc)]
//! This module adds serde serialization and deserialization support for amounts. //! This module adds serde serialization and deserialization support for amounts.
//! //!

View File

@ -3,6 +3,7 @@
// Module implements standardized serde-specific trait methods. // Module implements standardized serde-specific trait methods.
#![allow(missing_docs)] #![allow(missing_docs)]
#![allow(clippy::trivially_copy_pass_by_ref)] #![allow(clippy::trivially_copy_pass_by_ref)]
#![allow(clippy::missing_errors_doc)]
//! This module adds serde serialization and deserialization support for amounts. //! This module adds serde serialization and deserialization support for amounts.
//! //!

View File

@ -41,6 +41,10 @@ impl Height {
/// Constructs a new [`Height`] from a hex string. /// Constructs a new [`Height`] from a hex string.
/// ///
/// The input string may or may not contain a typical hex prefix e.g., `0x`. /// The input string may or may not contain a typical hex prefix e.g., `0x`.
///
/// # Errors
///
/// If the input string is not a valid hex representation of a block height.
pub fn from_hex(s: &str) -> Result<Self, ParseHeightError> { pub fn from_hex(s: &str) -> Result<Self, ParseHeightError> {
parse_hex(s, Self::from_consensus) parse_hex(s, Self::from_consensus)
} }
@ -139,6 +143,10 @@ impl Time {
/// Constructs a new [`Time`] from a hex string. /// Constructs a new [`Time`] from a hex string.
/// ///
/// The input string may or may not contain a typical hex prefix e.g., `0x`. /// The input string may or may not contain a typical hex prefix e.g., `0x`.
///
/// # Errors
///
/// If the input string is not a valid hex representation of a block time.
pub fn from_hex(s: &str) -> Result<Self, ParseTimeError> { parse_hex(s, Self::from_consensus) } pub fn from_hex(s: &str) -> Result<Self, ParseTimeError> { parse_hex(s, Self::from_consensus) }
/// Constructs a new block time. /// Constructs a new block time.

View File

@ -76,22 +76,29 @@ mod sealed {
/// Parses the input string as an integer returning an error carrying rich context. /// Parses the input string as an integer returning an error carrying rich context.
/// ///
/// On error this function allocates to copy the input string into the error return. If the caller /// If the caller has a `String` or `Box<str>` which is not used later it's better to call
/// has a `String` or `Box<str>` which is not used later it's better to call
/// [`parse::int_from_string`] or [`parse::int_from_box`] respectively. /// [`parse::int_from_string`] or [`parse::int_from_box`] respectively.
/// ///
/// [`parse::int_from_string`]: crate::parse::int_from_string /// [`parse::int_from_string`]: crate::parse::int_from_string
/// [`parse::int_from_box`]: crate::parse::int_from_box /// [`parse::int_from_box`]: crate::parse::int_from_box
///
/// # Errors
///
/// On error this function allocates to copy the input string into the error return.
pub fn int_from_str<T: Integer>(s: &str) -> Result<T, ParseIntError> { int(s) } pub fn int_from_str<T: Integer>(s: &str) -> Result<T, ParseIntError> { int(s) }
/// Parses the input string as an integer returning an error carrying rich context. /// Parses the input string as an integer returning an error carrying rich context.
/// ///
/// # Errors
///
/// On error the input string is moved into the error return without allocating. /// On error the input string is moved into the error return without allocating.
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub fn int_from_string<T: Integer>(s: alloc::string::String) -> Result<T, ParseIntError> { int(s) } pub fn int_from_string<T: Integer>(s: alloc::string::String) -> Result<T, ParseIntError> { int(s) }
/// Parses the input string as an integer returning an error carrying rich context. /// Parses the input string as an integer returning an error carrying rich context.
/// ///
/// # Errors
///
/// On error the input string is converted into the error return without allocating. /// On error the input string is converted into the error return without allocating.
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub fn int_from_box<T: Integer>(s: alloc::boxed::Box<str>) -> Result<T, ParseIntError> { int(s) } pub fn int_from_box<T: Integer>(s: alloc::boxed::Box<str>) -> Result<T, ParseIntError> { int(s) }