From: Matt Corallo Date: Thu, 28 Oct 2021 17:51:29 +0000 (+0000) Subject: f add reasoning for wrapper X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=b4dcb56013f3b60cff4bcc4a24c4948fba9366d3;p=rust-lightning f add reasoning for wrapper --- diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 2095f0519..9a1b04853 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -493,6 +493,10 @@ impl PeerManager" for an optional pubkey. +/// This works around `format!()` taking a reference to each argument, preventing +/// `if let Some(node_id) = peer.their_node_id { format!(.., node_id) } else { .. }` from compiling +/// due to lifetime errors. struct OptionalFromDebugger<'a>(&'a Option); impl core::fmt::Display for OptionalFromDebugger<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {