Add errors to doc comment in from_hex of array_newtype
What changed, and why it matters
This commit only adds documentation text to a Rust macro. It explains when a hex-string parsing function can fail. No code behavior changed, and there is no security issue in the patch itself.
No action needed; this is a documentation-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds an # Errors section to the doc comment of from_hex inside the impl_array_newtype_stringify macro. The function implementation is unchanged. The change is purely documentation to satisfy stricter documentation lints across crates that use this macro.
Changed components
include/array_newtype.rsInspect captured patch +5 / −0
diff --git a/include/array_newtype.rs b/include/array_newtype.rs
index 984f3ae0..af19d362 100644
--- a/include/array_newtype.rs
+++ b/include/array_newtype.rs
@@ -12,6 +12,11 @@ macro_rules! impl_array_newtype_stringify {
($t:ident, $len:literal) => {
impl $t {
/// Constructs a new `Self` from a hex string.
+ ///
+ /// # Errors
+ ///
+ /// Returns an error if `s` contains invalid characters or has incorrect length. (Should be
+ /// `N * 2`.)
pub fn from_hex(s: &str) -> Result<Self, $crate::hex::DecodeFixedLengthBytesError> {
Ok($t($crate::hex::decode_to_array(s)?))
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.