From b4dcb56013f3b60cff4bcc4a24c4948fba9366d3 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 28 Oct 2021 17:51:29 +0000 Subject: [PATCH] f add reasoning for wrapper --- lightning/src/ln/peer_handler.rs | 4 ++++ 1 file changed, 4 insertions(+) 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> { -- 2.39.5