Skip to content

Commit 28b7430

Browse files
committed
f add reasoning for wrapper
1 parent 81673d9 commit 28b7430

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lightning/src/ln/peer_handler.rs

+4
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,10 @@ impl<Descriptor: SocketDescriptor, RM: Deref, L: Deref> PeerManager<Descriptor,
493493
}
494494
}
495495

496+
/// A simple wrapper that optionally prints " from <pubkey>" for an optional pubkey.
497+
/// This works around `format!()` taking a reference to each argument, preventing
498+
/// `if let Some(node_id) = peer.their_node_id { format!(.., node_id) } else { .. }` from compiling
499+
/// due to lifetime errors.
496500
struct OptionalFromDebugger<'a>(&'a Option<PublicKey>);
497501
impl core::fmt::Display for OptionalFromDebugger<'_> {
498502
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {

0 commit comments

Comments
 (0)