Skip to content

Commit 70fc399

Browse files
committed
Merge rust-bitcoin#3900: units: Fix missing_errors_doc clippy lint
f9be30d 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 rust-bitcoin#3825 ACKs for top commit: tcharding: ACK f9be30d apoelstra: ACK f9be30d; successfully ran local tests Tree-SHA512: 8039804ab86c18dceadb425c8531cd4064431393367c6053249e00386f48998d8d84a3aee6ad139e7e2ca3ac3c94e05ee694d72270bf285f6b90d0ff821e622e
2 parents f1abc77 + f9be30d commit 70fc399

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

units/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ match_wild_err_arm = "warn"
105105
match_wildcard_for_single_variants = "warn"
106106
maybe_infinite_iter = "warn"
107107
mismatching_type_param_order = "warn"
108-
missing_errors_doc = "allow" # TODO: Still needs considering.
108+
missing_errors_doc = "warn"
109109
missing_fields_in_debug = "warn"
110110
missing_panics_doc = "warn"
111111
must_use_candidate = "allow" # Useful for audit but many false positives.

units/src/amount/serde.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// methods are implementation of a standardized serde-specific signature
44
#![allow(missing_docs)]
5+
#![allow(clippy::missing_errors_doc)]
56

67
//! This module adds serde serialization and deserialization support for amounts.
78
//!

units/src/fee_rate/serde.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Module implements standardized serde-specific trait methods.
44
#![allow(missing_docs)]
55
#![allow(clippy::trivially_copy_pass_by_ref)]
6+
#![allow(clippy::missing_errors_doc)]
67

78
//! This module adds serde serialization and deserialization support for amounts.
89
//!

units/src/locktime/absolute.rs

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ impl Height {
4141
/// Constructs a new [`Height`] from a hex string.
4242
///
4343
/// The input string may or may not contain a typical hex prefix e.g., `0x`.
44+
///
45+
/// # Errors
46+
///
47+
/// If the input string is not a valid hex representation of a block height.
4448
pub fn from_hex(s: &str) -> Result<Self, ParseHeightError> {
4549
parse_hex(s, Self::from_consensus)
4650
}
@@ -139,6 +143,10 @@ impl Time {
139143
/// Constructs a new [`Time`] from a hex string.
140144
///
141145
/// The input string may or may not contain a typical hex prefix e.g., `0x`.
146+
///
147+
/// # Errors
148+
///
149+
/// If the input string is not a valid hex representation of a block time.
142150
pub fn from_hex(s: &str) -> Result<Self, ParseTimeError> { parse_hex(s, Self::from_consensus) }
143151

144152
/// Constructs a new block time.

units/src/parse.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,29 @@ mod sealed {
7676

7777
/// Parses the input string as an integer returning an error carrying rich context.
7878
///
79-
/// On error this function allocates to copy the input string into the error return. If the caller
80-
/// has a `String` or `Box<str>` which is not used later it's better to call
79+
/// If the caller has a `String` or `Box<str>` which is not used later it's better to call
8180
/// [`parse::int_from_string`] or [`parse::int_from_box`] respectively.
8281
///
8382
/// [`parse::int_from_string`]: crate::parse::int_from_string
8483
/// [`parse::int_from_box`]: crate::parse::int_from_box
84+
///
85+
/// # Errors
86+
///
87+
/// On error this function allocates to copy the input string into the error return.
8588
pub fn int_from_str<T: Integer>(s: &str) -> Result<T, ParseIntError> { int(s) }
8689

8790
/// Parses the input string as an integer returning an error carrying rich context.
8891
///
92+
/// # Errors
93+
///
8994
/// On error the input string is moved into the error return without allocating.
9095
#[cfg(feature = "alloc")]
9196
pub fn int_from_string<T: Integer>(s: alloc::string::String) -> Result<T, ParseIntError> { int(s) }
9297

9398
/// Parses the input string as an integer returning an error carrying rich context.
9499
///
100+
/// # Errors
101+
///
95102
/// On error the input string is converted into the error return without allocating.
96103
#[cfg(feature = "alloc")]
97104
pub fn int_from_box<T: Integer>(s: alloc::boxed::Box<str>) -> Result<T, ParseIntError> { int(s) }

0 commit comments

Comments
 (0)