Skip to content

Commit ef246ed

Browse files
committed
Fix compilation in payment rustdoc examples
The samples were not valid rust, but previous versions of rustc had a bug where they were accepted anyway. Latest rustc beta no longer accepts these.
1 parent 9fcc626 commit ef246ed

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lightning-invoice/src/payment.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@
6363
//! # ) -> Result<(), PaymentSendFailure> { unimplemented!() }
6464
//! # }
6565
//! #
66-
//! # struct FakeRouter {};
66+
//! # struct FakeRouter {}
6767
//! # impl<S: Score> Router<S> for FakeRouter {
6868
//! # fn find_route(
6969
//! # &self, payer: &PublicKey, params: &RouteParameters, payment_hash: &PaymentHash,
7070
//! # first_hops: Option<&[&ChannelDetails]>, scorer: &S
7171
//! # ) -> Result<Route, LightningError> { unimplemented!() }
7272
//! # }
7373
//! #
74-
//! # struct FakeScorer {};
74+
//! # struct FakeScorer {}
7575
//! # impl Writeable for FakeScorer {
7676
//! # fn write<W: Writer>(&self, w: &mut W) -> Result<(), std::io::Error> { unimplemented!(); }
7777
//! # }
@@ -82,7 +82,7 @@
8282
//! # fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
8383
//! # }
8484
//! #
85-
//! # struct FakeLogger {};
85+
//! # struct FakeLogger {}
8686
//! # impl Logger for FakeLogger {
8787
//! # fn log(&self, record: &Record) { unimplemented!() }
8888
//! # }
@@ -102,12 +102,13 @@
102102
//! let invoice_payer = InvoicePayer::new(&payer, router, &scorer, &logger, event_handler, RetryAttempts(2));
103103
//!
104104
//! let invoice = "...";
105-
//! let invoice = invoice.parse::<Invoice>().unwrap();
106-
//! invoice_payer.pay_invoice(&invoice).unwrap();
105+
//! if let Ok(invoice) = invoice.parse::<Invoice>() {
106+
//! invoice_payer.pay_invoice(&invoice).unwrap();
107107
//!
108108
//! # let event_provider = FakeEventProvider {};
109-
//! loop {
110-
//! event_provider.process_pending_events(&invoice_payer);
109+
//! loop {
110+
//! event_provider.process_pending_events(&invoice_payer);
111+
//! }
111112
//! }
112113
//! # }
113114
//! ```

0 commit comments

Comments
 (0)