summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-21 10:23:04 +0300
committerLars Wirzenius <liw@sequoia-pgp.org>2021-09-30 08:31:00 +0300
commite6a335b93a10620bcb7cbfa32e232949758f0c99 (patch)
tree834bfcb8f3ddb7564bc352f90f3c000fe5bf62ce /openpgp
parente917221b626b816d79af95eded8154065100cdf1 (diff)
Drop unnecessary lifetime notations
Rust can automatically deduce lifetimes in some cases ("lifetime elision"). While adding unnecessary lifetime annotations is not incorrect, it can make it harder to follow the code: why is there a lifetime annotation here? What is the reason why it's needed? Is something unusual going on. This removes a few unnecessary lifetime annotations, as found by the clippy lint needless_lifetimes: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/packet/container.rs6
-rw-r--r--openpgp/src/packet/signature/subpacket.rs6
-rw-r--r--openpgp/src/parse/map.rs2
-rw-r--r--openpgp/src/serialize/cert.rs2
4 files changed, 8 insertions, 8 deletions
diff --git a/openpgp/src/packet/container.rs b/openpgp/src/packet/container.rs
index 42634c6e..15e24a50 100644
--- a/openpgp/src/packet/container.rs
+++ b/openpgp/src/packet/container.rs
@@ -270,7 +270,7 @@ impl Container {
/// Returns an iterator over the packet's immediate children.
///
/// Returns `None` if the body is not structured.
- pub fn children<'a>(&'a self) -> Option<slice::Iter<'a, Packet>> {
+ pub fn children(&self) -> Option<slice::Iter<Packet>> {
Some(self.children_ref()?.iter())
}
@@ -435,8 +435,8 @@ impl Packet {
}
/// Returns an iterator over the packet's immediate children.
- pub(crate) fn children<'a>(&'a self)
- -> Option<impl Iterator<Item = &'a Packet>> {
+ pub(crate) fn children(& self)
+ -> Option<impl Iterator<Item = &Packet>> {
self.container_ref().and_then(|c| c.children())
}
diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs
index c1f7c510..f71647d5 100644
--- a/openpgp/src/packet/signature/subpacket.rs
+++ b/openpgp/src/packet/signature/subpacket.rs
@@ -2108,7 +2108,7 @@ impl SubpacketAreas {
///
/// For subpackets that can safely occur in both subpacket areas,
/// this function prefers instances in the hashed subpacket area.
- pub fn subpacket<'a>(&'a self, tag: SubpacketTag) -> Option<&Subpacket> {
+ pub fn subpacket(&self, tag: SubpacketTag) -> Option<&Subpacket> {
if let Some(sb) = self.hashed_area().subpacket(tag) {
return Some(sb);
}
@@ -2141,8 +2141,8 @@ impl SubpacketAreas {
///
/// For subpackets that can safely occur in both subpacket areas,
/// this function prefers instances in the hashed subpacket area.
- pub fn subpacket_mut<'a>(&'a mut self, tag: SubpacketTag)
- -> Option<&mut Subpacket> {
+ pub fn subpacket_mut(&mut self, tag: SubpacketTag)
+ -> Option<&mut Subpacket> {
if let Some(_) = self.hashed_area().subpacket(tag) {
return self.hashed_area_mut().subpacket_mut(tag);
}
diff --git a/openpgp/src/parse/map.rs b/openpgp/src/parse/map.rs
index b460deea..b0c7bbea 100644
--- a/openpgp/src/parse/map.rs
+++ b/openpgp/src/parse/map.rs
@@ -90,7 +90,7 @@ impl Map {
/// assert_eq!(map.iter().count(), 6);
/// # Ok(()) }
/// ```
- pub fn iter<'a>(&'a self) -> impl Iterator<Item = Field<'a>> + Send + Sync {
+ pub fn iter(&self) -> impl Iterator<Item = Field> + Send + Sync {
Iter::new(self)
}
}
diff --git a/openpgp/src/serialize/cert.rs b/openpgp/src/serialize/cert.rs
index c46e4253..b6967f02 100644
--- a/openpgp/src/serialize/cert.rs
+++ b/openpgp/src/serialize/cert.rs
@@ -198,7 +198,7 @@ impl Cert {
/// This object writes out secret keys during serialization.
///
/// [`TSK`]: crate::serialize::TSK
- pub fn as_tsk<'a>(&'a self) -> TSK<'a> {
+ pub fn as_tsk(&self) -> TSK {
TSK::new(self)
}
}