From b65f05ce19f7f581a5770d82b82b2ee25a9e9971 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 29 May 2024 14:57:53 +0000 Subject: [PATCH] simplify lifetime parameters Signed-off-by: Jason Volk --- src/service/rooms/state_cache/data.rs | 4 ++-- src/service/rooms/state_cache/mod.rs | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/service/rooms/state_cache/data.rs b/src/service/rooms/state_cache/data.rs index 1c0571c9..acf390d9 100644 --- a/src/service/rooms/state_cache/data.rs +++ b/src/service/rooms/state_cache/data.rs @@ -72,7 +72,7 @@ pub trait Data: Send + Sync { fn get_left_count(&self, room_id: &RoomId, user_id: &UserId) -> Result>; /// Returns an iterator over all rooms this user joined. - fn rooms_joined<'a>(&'a self, user_id: &UserId) -> Box> + 'a>; + fn rooms_joined(&self, user_id: &UserId) -> Box> + '_>; /// Returns an iterator over all rooms a user was invited to. fn rooms_invited<'a>(&'a self, user_id: &UserId) -> StrippedStateEventIter<'a>; @@ -494,7 +494,7 @@ impl Data for KeyValueDatabase { /// Returns an iterator over all rooms this user joined. #[tracing::instrument(skip(self))] - fn rooms_joined<'a>(&'a self, user_id: &UserId) -> Box> + 'a> { + fn rooms_joined(&self, user_id: &UserId) -> Box> + '_> { Box::new( self.userroomid_joined .scan_prefix(user_id.as_bytes().to_vec()) diff --git a/src/service/rooms/state_cache/mod.rs b/src/service/rooms/state_cache/mod.rs index 1cfd56db..2b3f5fb7 100644 --- a/src/service/rooms/state_cache/mod.rs +++ b/src/service/rooms/state_cache/mod.rs @@ -239,7 +239,7 @@ impl Service { /// Returns an iterator of all servers participating in this room. #[tracing::instrument(skip(self))] - pub fn room_servers<'a>(&'a self, room_id: &RoomId) -> impl Iterator> + 'a { + pub fn room_servers(&self, room_id: &RoomId) -> impl Iterator> + '_ { self.db.room_servers(room_id) } @@ -251,7 +251,7 @@ impl Service { /// Returns an iterator of all rooms a server participates in (as far as we /// know). #[tracing::instrument(skip(self))] - pub fn server_rooms<'a>(&'a self, server: &ServerName) -> impl Iterator> + 'a { + pub fn server_rooms(&self, server: &ServerName) -> impl Iterator> + '_ { self.db.server_rooms(server) } @@ -282,7 +282,7 @@ impl Service { /// Returns an iterator over all joined members of a room. #[tracing::instrument(skip(self))] - pub fn room_members<'a>(&'a self, room_id: &RoomId) -> impl Iterator> + 'a { + pub fn room_members(&self, room_id: &RoomId) -> impl Iterator> + '_ { self.db.room_members(room_id) } @@ -308,13 +308,13 @@ impl Service { /// Returns an iterator over all User IDs who ever joined a room. #[tracing::instrument(skip(self))] - pub fn room_useroncejoined<'a>(&'a self, room_id: &RoomId) -> impl Iterator> + 'a { + pub fn room_useroncejoined(&self, room_id: &RoomId) -> impl Iterator> + '_ { self.db.room_useroncejoined(room_id) } /// Returns an iterator over all invited members of a room. #[tracing::instrument(skip(self))] - pub fn room_members_invited<'a>(&'a self, room_id: &RoomId) -> impl Iterator> + 'a { + pub fn room_members_invited(&self, room_id: &RoomId) -> impl Iterator> + '_ { self.db.room_members_invited(room_id) } @@ -330,15 +330,15 @@ impl Service { /// Returns an iterator over all rooms this user joined. #[tracing::instrument(skip(self))] - pub fn rooms_joined<'a>(&'a self, user_id: &UserId) -> impl Iterator> + 'a { + pub fn rooms_joined(&self, user_id: &UserId) -> impl Iterator> + '_ { self.db.rooms_joined(user_id) } /// Returns an iterator over all rooms a user was invited to. #[tracing::instrument(skip(self))] - pub fn rooms_invited<'a>( - &'a self, user_id: &UserId, - ) -> impl Iterator>)>> + 'a { + pub fn rooms_invited( + &self, user_id: &UserId, + ) -> impl Iterator>)>> + '_ { self.db.rooms_invited(user_id) } @@ -354,9 +354,9 @@ impl Service { /// Returns an iterator over all rooms a user left. #[tracing::instrument(skip(self))] - pub fn rooms_left<'a>( - &'a self, user_id: &UserId, - ) -> impl Iterator>)>> + 'a { + pub fn rooms_left( + &self, user_id: &UserId, + ) -> impl Iterator>)>> + '_ { self.db.rooms_left(user_id) }