From: Matt Corallo Date: Sun, 31 May 2020 03:18:35 +0000 (-0400) Subject: Drop some unnecessary lifetime specifiers in return type definitions X-Git-Tag: v0.0.12~54^2~8 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=aa14fe58301c3c3d80b00aa74e61197db1e577e8;p=rust-lightning Drop some unnecessary lifetime specifiers in return type definitions In general, we don't need an explicit lifetime when doing something like: fn get_thing(&self) -> &Thing { &self.thing }. This also makes it easier to reason about what's going on in the bindings generation. --- diff --git a/lightning/src/chain/chaininterface.rs b/lightning/src/chain/chaininterface.rs index 89c57dc44..5cd87c49f 100644 --- a/lightning/src/chain/chaininterface.rs +++ b/lightning/src/chain/chaininterface.rs @@ -274,7 +274,7 @@ impl<'a, CL: Deref + 'a, C: Deref> BlockNotifier<'a /// /// Handles re-scanning the block and calling block_connected again if listeners register new /// watch data during the callbacks for you (see ChainListener::block_connected for more info). - pub fn block_connected<'b>(&self, block: &'b Block, height: u32) { + pub fn block_connected(&self, block: &Block, height: u32) { let mut reentered = true; while reentered { let (matched, matched_index) = self.chain_monitor.filter_block(block); diff --git a/lightning/src/chain/keysinterface.rs b/lightning/src/chain/keysinterface.rs index 31ed2d15c..c4045e9c6 100644 --- a/lightning/src/chain/keysinterface.rs +++ b/lightning/src/chain/keysinterface.rs @@ -196,9 +196,9 @@ impl Readable for SpendableOutputDescriptor { // ChannelMonitors instead of expecting to clone the one out of the Channel into the monitors. pub trait ChannelKeys : Send+Clone { /// Gets the commitment seed - fn commitment_seed<'a>(&'a self) -> &'a [u8; 32]; + fn commitment_seed(&self) -> &[u8; 32]; /// Gets the local channel public keys and basepoints - fn pubkeys<'a>(&'a self) -> &'a ChannelPublicKeys; + fn pubkeys(&self) -> &ChannelPublicKeys; /// Gets arbitrary identifiers describing the set of keys which are provided back to you in /// some SpendableOutputDescriptor types. These should be sufficient to identify this /// ChannelKeys object uniquely and lookup or re-derive its keys. @@ -405,7 +405,7 @@ impl InMemoryChannelKeys { impl ChannelKeys for InMemoryChannelKeys { fn commitment_seed(&self) -> &[u8; 32] { &self.commitment_seed } - fn pubkeys<'a>(&'a self) -> &'a ChannelPublicKeys { &self.local_channel_pubkeys } + fn pubkeys(&self) -> &ChannelPublicKeys { &self.local_channel_pubkeys } fn key_derivation_params(&self) -> (u64, u64) { self.key_derivation_params } fn sign_remote_commitment(&self, feerate_per_kw: u32, commitment_tx: &Transaction, keys: &TxCreationKeys, htlcs: &[&HTLCOutputInCommitment], to_self_delay: u16, secp_ctx: &Secp256k1) -> Result<(Signature, Vec), ()> { diff --git a/lightning/src/util/enforcing_trait_impls.rs b/lightning/src/util/enforcing_trait_impls.rs index 5157c1a6c..ee66d5f3a 100644 --- a/lightning/src/util/enforcing_trait_impls.rs +++ b/lightning/src/util/enforcing_trait_impls.rs @@ -49,7 +49,7 @@ impl EnforcingChannelKeys { impl ChannelKeys for EnforcingChannelKeys { fn commitment_seed(&self) -> &[u8; 32] { self.inner.commitment_seed() } - fn pubkeys<'a>(&'a self) -> &'a ChannelPublicKeys { self.inner.pubkeys() } + fn pubkeys(&self) -> &ChannelPublicKeys { self.inner.pubkeys() } fn key_derivation_params(&self) -> (u64, u64) { self.inner.key_derivation_params() } fn sign_remote_commitment(&self, feerate_per_kw: u32, commitment_tx: &Transaction, keys: &TxCreationKeys, htlcs: &[&HTLCOutputInCommitment], to_self_delay: u16, secp_ctx: &Secp256k1) -> Result<(Signature, Vec), ()> {