summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-21 10:23:04 +0300
committerLars Wirzenius <liw@liw.fi>2021-09-27 09:34:22 +0300
commit389622d84fa635a08e310c843cf69534de0b6cd2 (patch)
treea664bef2bf1b5496e875f0b837ab1f0d826f4355
parentc3837e1016bd92b72fc789940c813984a828d7ee (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? 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
-rw-r--r--ipc/src/assuan/mod.rs2
-rw-r--r--ipc/src/gnupg.rs2
-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
6 files changed, 10 insertions, 10 deletions
diff --git a/ipc/src/assuan/mod.rs b/ipc/src/assuan/mod.rs
index 9f7ab824..5a4d9f20 100644
--- a/ipc/src/assuan/mod.rs
+++ b/ipc/src/assuan/mod.rs
@@ -138,7 +138,7 @@ impl Client {
/// using this objects [`Stream`] implementation.
///
/// [`Stream`]: #impl-Stream
- pub fn cancel<'a>(&'a mut self) -> Result<()> {
+ pub fn cancel(&mut self) -> Result<()> {
self.send("CAN")
}
diff --git a/ipc/src/gnupg.rs b/ipc/src/gnupg.rs
index f008d012..68906829 100644
--- a/ipc/src/gnupg.rs
+++ b/ipc/src/gnupg.rs
@@ -324,7 +324,7 @@ impl Agent {
/// Note: This function does not try to start the server. If no
/// server is running for the given context, this operation will
/// fail.
- pub async fn connect<'c>(ctx: &'c Context) -> Result<Self> {
+ pub async fn connect(ctx: &Context) -> Result<Self> {
let path = ctx.socket("agent")?;
Self::connect_to(path).await
}
diff --git a/openpgp/src/packet/container.rs b/openpgp/src/packet/container.rs
index 42634c6e..39f7208d 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)
}
}