units: Fix `missing_errors_doc` clippy lint

Change the lint to `warn` in `units/Cargo.toml`.
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.
This commit is contained in:
Jamil Lambert, PhD 2025-01-13 19:16:32 +00:00
parent 87d93891a3
commit f9be30ddbe
No known key found for this signature in database
GPG Key ID: 54DC29234AB5D2C0
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"
maybe_infinite_iter = "warn"
mismatching_type_param_order = "warn"
missing_errors_doc = "allow" # TODO: Still needs considering.
missing_errors_doc = "warn"
missing_fields_in_debug = "warn"
missing_panics_doc = "allow" # TODO: Still needs considering.
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
#![allow(missing_docs)]
#![allow(clippy::missing_errors_doc)]
//! This module adds serde serialization and deserialization support for amounts.
//!

View File

@ -3,6 +3,7 @@
// Module implements standardized serde-specific trait methods.
#![allow(missing_docs)]
#![allow(clippy::trivially_copy_pass_by_ref)]
#![allow(clippy::missing_errors_doc)]
//! 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.
///
/// 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> {
parse_hex(s, Self::from_consensus)
}
@ -139,6 +143,10 @@ impl Time {
/// Constructs a new [`Time`] from a hex string.
///
/// 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) }
/// 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.
///
/// On error this function allocates to copy the input string into the error return. If the caller
/// has a `String` or `Box<str>` which is not used later it's better to call
/// If the caller 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`]: crate::parse::int_from_string
/// [`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) }
/// 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.
#[cfg(feature = "alloc")]
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.
///
/// # Errors
///
/// On error the input string is converted into the error return without allocating.
#[cfg(feature = "alloc")]
pub fn int_from_box<T: Integer>(s: alloc::boxed::Box<str>) -> Result<T, ParseIntError> { int(s) }