From: Jeffrey Czyz Date: Fri, 28 Jan 2022 13:55:52 +0000 (-0600) Subject: f - Remove unnecessary lifetime X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=45b802169632969da2df45cf6235a9275d986a88;p=rust-lightning f - Remove unnecessary lifetime --- diff --git a/lightning/src/routing/network_graph.rs b/lightning/src/routing/network_graph.rs index ff95b5d59..c641ced7d 100644 --- a/lightning/src/routing/network_graph.rs +++ b/lightning/src/routing/network_graph.rs @@ -698,25 +698,25 @@ impl_writeable_tlv_based!(ChannelInfo, { /// A wrapper around [`ChannelInfo`] representing information about the channel as directed from a /// source node to a target node. #[derive(Clone, Debug)] -pub struct DirectedChannelInfo<'a: 'b, 'b> { +pub struct DirectedChannelInfo<'a> { channel: &'a ChannelInfo, - direction: Option<&'b ChannelUpdateInfo>, - source: &'b NodeId, - target: &'b NodeId, + direction: Option<&'a ChannelUpdateInfo>, + source: &'a NodeId, + target: &'a NodeId, } -impl<'a: 'b, 'b> DirectedChannelInfo<'a, 'b> { +impl<'a: 'b, 'b> DirectedChannelInfo<'a> { /// Returns information for the channel. pub fn channel(&self) -> &'a ChannelInfo { self.channel } /// Returns information for the direction. - pub fn direction(&self) -> Option<&'b ChannelUpdateInfo> { self.direction } + pub fn direction(&self) -> Option<&'a ChannelUpdateInfo> { self.direction } /// Returns the node id for the source. - pub fn source(&self) -> &'b NodeId { self.source } + pub fn source(&self) -> &'a NodeId { self.source } /// Returns the node id for the target. - pub fn target(&self) -> &'b NodeId { self.target } + pub fn target(&self) -> &'a NodeId { self.target } /// Returns the [`EffectiveCapacity`] of the channel in the direction. /// @@ -741,7 +741,7 @@ impl<'a: 'b, 'b> DirectedChannelInfo<'a, 'b> { } /// Returns `Some` if [`ChannelUpdateInfo`] is available in the direction. - pub(super) fn with_update(self) -> Option> { + pub(super) fn with_update(self) -> Option> { match self.direction { Some(_) => Some(DirectedChannelInfoWithUpdate { inner: self }), None => None, @@ -751,18 +751,18 @@ impl<'a: 'b, 'b> DirectedChannelInfo<'a, 'b> { /// A [`DirectedChannelInfo`] with [`ChannelUpdateInfo`] available in its the direction. #[derive(Clone, Debug)] -pub(super) struct DirectedChannelInfoWithUpdate<'a: 'b, 'b> { - inner: DirectedChannelInfo<'a, 'b>, +pub(super) struct DirectedChannelInfoWithUpdate<'a> { + inner: DirectedChannelInfo<'a>, } -impl<'a: 'b, 'b> DirectedChannelInfoWithUpdate<'a, 'b> { +impl<'a> DirectedChannelInfoWithUpdate<'a> { /// Returns information for the channel. #[inline] pub(super) fn channel(&self) -> &'a ChannelInfo { &self.inner.channel } /// Returns information for the direction. #[inline] - pub(super) fn direction(&self) -> &'b ChannelUpdateInfo { self.inner.direction.unwrap() } + pub(super) fn direction(&self) -> &'a ChannelUpdateInfo { self.inner.direction.unwrap() } /// Returns the [`EffectiveCapacity`] of the channel in the direction. #[inline] diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 835fc91c9..b1e24627d 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -355,7 +355,7 @@ enum CandidateRouteHop<'a> { }, /// A hop found in the [`NetworkGraph`], where the channel capacity may or may not be known. PublicHop { - info: DirectedChannelInfoWithUpdate<'a, 'a>, + info: DirectedChannelInfoWithUpdate<'a>, short_channel_id: u64, }, /// A hop to the payee found in the payment invoice, though not necessarily a direct channel.