From: Arik Sosman Date: Thu, 19 May 2022 17:07:35 +0000 (-0700) Subject: Fix rust beta docs lightning-invoice crate. X-Git-Tag: v0.0.107~20^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=71d89d2c98f981c1a096eaba8044302cefb398ea;p=rust-lightning Fix rust beta docs lightning-invoice crate. --- diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index 9fcb4af1b..383d8668c 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -795,18 +795,15 @@ impl SignedRawInvoice { /// variant. If no element was found `None` gets returned. /// /// The following example would extract the first B. -/// ``` -/// use Enum::* /// /// enum Enum { /// A(u8), /// B(u16) /// } /// -/// let elements = vec![A(1), A(2), B(3), A(4)] +/// let elements = vec![Enum::A(1), Enum::A(2), Enum::B(3), Enum::A(4)]; /// -/// assert_eq!(find_extract!(elements.iter(), Enum::B(ref x), x), Some(3u16)) -/// ``` +/// assert_eq!(find_extract!(elements.iter(), Enum::B(x), x), Some(3u16)); macro_rules! find_extract { ($iter:expr, $enm:pat, $enm_var:ident) => { find_all_extract!($iter, $enm, $enm_var).next() @@ -817,20 +814,18 @@ macro_rules! find_extract { /// variant through an iterator. /// /// The following example would extract all A. -/// ``` -/// use Enum::* /// /// enum Enum { /// A(u8), /// B(u16) /// } /// -/// let elements = vec![A(1), A(2), B(3), A(4)] +/// let elements = vec![Enum::A(1), Enum::A(2), Enum::B(3), Enum::A(4)]; /// /// assert_eq!( -/// find_all_extract!(elements.iter(), Enum::A(ref x), x).collect::>(), -/// vec![1u8, 2u8, 4u8]) -/// ``` +/// find_all_extract!(elements.iter(), Enum::A(x), x).collect::>(), +/// vec![1u8, 2u8, 4u8] +/// ); macro_rules! find_all_extract { ($iter:expr, $enm:pat, $enm_var:ident) => { $iter.filter_map(|tf| match *tf {