~kennylevinsen/greetd-devel

Remove lifetimes that can be inferred v1 APPLIED

Hugo Osvaldo Barrera: 1
 Remove lifetimes that can be inferred

 3 files changed, 8 insertions(+), 10 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kennylevinsen/greetd-devel/patches/58089/mbox | git am -3
Learn more about email & git

[PATCH] Remove lifetimes that can be inferred Export this patch

Remove redundant lifetimes that are automatically inferred by the
compiler.
---
 greetd/src/session/conv.rs      | 9 ++++-----
 greetd/src/session/interface.rs | 2 +-
 inish/src/lib.rs                | 7 +++----
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/greetd/src/session/conv.rs b/greetd/src/session/conv.rs
index 7b67b93..44c4e00 100644
--- a/greetd/src/session/conv.rs
+++ b/greetd/src/session/conv.rs
@@ -1,13 +1,12 @@
use super::worker::{AuthMessageType, ParentToSessionChild, SessionChildToParent};
use crate::pam::converse::Converse;

/// SessionConv is a PAM conversation implementation that forwards questions
/// over a socket.
/// PAM conversation implementation that forwards questions over a socket.
pub struct SessionConv<'a> {
    sock: &'a std::os::unix::net::UnixDatagram,
}

impl<'a> SessionConv<'a> {
impl SessionConv<'_> {
    fn question(&self, msg: &str, style: AuthMessageType) -> Result<Option<String>, ()> {
        let mut data = [0; 10240];
        let msg = SessionChildToParent::PamMessage {
@@ -28,12 +27,12 @@ impl<'a> SessionConv<'a> {
    }

    /// Create a new `PasswordConv` handler
    pub fn new(sock: &'a std::os::unix::net::UnixDatagram) -> SessionConv<'a> {
    pub fn new(sock: &std::os::unix::net::UnixDatagram) -> SessionConv {
        SessionConv { sock }
    }
}

impl<'a> Converse for SessionConv<'a> {
impl Converse for SessionConv<'_> {
    fn prompt_echo(&self, msg: &str) -> Result<String, ()> {
        match self.question(msg, AuthMessageType::Visible) {
            Ok(Some(response)) => Ok(response),
diff --git a/greetd/src/session/interface.rs b/greetd/src/session/interface.rs
index 188c75c..ee727f4 100644
--- a/greetd/src/session/interface.rs
+++ b/greetd/src/session/interface.rs
@@ -29,7 +29,7 @@ trait AsyncSend {
}

#[async_trait]
impl<'a> AsyncSend for ParentToSessionChild<'a> {
impl AsyncSend for ParentToSessionChild<'_> {
    async fn send(&self, sock: &mut TokioUnixDatagram) -> Result<(), Error> {
        let mut out =
            serde_json::to_vec(self).map_err(|e| format!("unable to serialize message: {e}"))?;
diff --git a/inish/src/lib.rs b/inish/src/lib.rs
index a75437e..a9c11c3 100644
--- a/inish/src/lib.rs
+++ b/inish/src/lib.rs
@@ -1,9 +1,8 @@
use std::{collections::HashMap, error::Error};

fn parse_field<'a>(line: &'a str) -> Result<(&'a str, &'a str), Box<dyn Error>> {
    let split = match line.find('=') {
        Some(v) => v,
        None => return Err("expected equals sign on line, but found none".into()),
fn parse_field(line: &str) -> Result<(&str, &str), Box<dyn Error>> {
    let Some(split) = line.find('=') else {
        return Err("expected equals sign on line, but found none".into());
    };

    let (key, value) = line.split_at(split);
-- 
2.48.1
Applied, thanks!