Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 275adc6

Browse files
committed
Add docs to the code create by sha256t_hash_newtype macro
When using the `sha256t_hash_newtype` currently no docs are generated, this causes lint errors for users who lint for such things. Add docs to the new type created by the `sha256t_hash_newtype` macro. (This is identical to how we do it in the duplicate macro of the same name in `rust-bitcoin`, which can be removed in favour of this one after this patch is applied.)
1 parent 029d665 commit 275adc6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/sha256t.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,14 @@ impl<T: Tag> HashTrait for Hash<T> {
143143
#[macro_export]
144144
macro_rules! sha256t_hash_newtype {
145145
($newtype:ident, $tag:ident, $midstate:ident, $midstate_len:expr, $docs:meta, $reverse: expr) => {
146-
/// The tag used for [$newtype].
146+
sha256t_hash_newtype!($newtype, $tag, $midstate, $midstate_len, $docs, $reverse, stringify!($newtype));
147+
};
148+
149+
($newtype:ident, $tag:ident, $midstate:ident, $midstate_len:expr, $docs:meta, $reverse: expr, $sname:expr) => {
150+
#[doc = "The tag used for ["]
151+
#[doc = $sname]
152+
#[doc = "]"]
153+
#[derive(Copy, Clone, PartialEq, Eq, Default, PartialOrd, Ord, Hash)]
147154
pub struct $tag;
148155

149156
impl $crate::sha256t::Tag for $tag {

0 commit comments

Comments
 (0)