From 71d89d2c98f981c1a096eaba8044302cefb398ea Mon Sep 17 00:00:00 2001 From: Arik Sosman Date: Thu, 19 May 2022 10:07:35 -0700 Subject: [PATCH] Fix rust beta docs lightning-invoice crate. --- lightning-invoice/src/lib.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) 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 { -- 2.39.5