summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-08-13 14:21:10 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-08-13 14:31:14 -0400
commit4ace27830ffea715c30f366765aeb231572c60ec (patch)
treed07ceb9f445bd4c9601273e1de002addcbd8c645 /src
parentbfcdc3fde5a39eb1d51a30c34d31330ea88b242f (diff)
Rust 1.89: Add elided lifetime parameters (`'_`) where appropriate.
Rust 1.89 added a new warning: warning: hiding a lifetime that's elided elsewhere is confusing --> src/setup/repo.rs:4:14 | 4 | fn setup(&mut self) -> Setup; | ^^^^^^^^^ ----- the same lifetime is hidden here | | | the lifetime is elided here | = help: the same lifetime is referred to in inconsistent ways, making the signature confusing help: use `'_` for type paths | 4 | fn setup(&mut self) -> Setup<'_>; | ++++ I don't entirely agree with the style advice here, but lifetime elision style is an evolving area in Rust and I'd rather track the Rust team's recommendations than invent my own, so I've added all of them.
Diffstat (limited to 'src')
-rw-r--r--src/app.rs16
-rw-r--r--src/conversation/repo.rs4
-rw-r--r--src/event/repo.rs4
-rw-r--r--src/invite/repo.rs4
-rw-r--r--src/message/repo.rs4
-rw-r--r--src/setup/repo.rs4
-rw-r--r--src/test/fixtures/future.rs24
-rw-r--r--src/token/repo/auth.rs4
-rw-r--r--src/token/repo/token.rs4
-rw-r--r--src/user/repo.rs4
10 files changed, 36 insertions, 36 deletions
diff --git a/src/app.rs b/src/app.rs
index 133ee04..ab8da7e 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -33,36 +33,36 @@ impl App {
}
impl App {
- pub const fn boot(&self) -> Boot {
+ pub const fn boot(&self) -> Boot<'_> {
Boot::new(&self.db)
}
- pub const fn conversations(&self) -> Conversations {
+ pub const fn conversations(&self) -> Conversations<'_> {
Conversations::new(&self.db, &self.events)
}
- pub const fn events(&self) -> Events {
+ pub const fn events(&self) -> Events<'_> {
Events::new(&self.db, &self.events)
}
- pub const fn invites(&self) -> Invites {
+ pub const fn invites(&self) -> Invites<'_> {
Invites::new(&self.db, &self.events)
}
#[cfg(test)]
- pub const fn users(&self) -> Users {
+ pub const fn users(&self) -> Users<'_> {
Users::new(&self.db, &self.events)
}
- pub const fn messages(&self) -> Messages {
+ pub const fn messages(&self) -> Messages<'_> {
Messages::new(&self.db, &self.events)
}
- pub const fn setup(&self) -> Setup {
+ pub const fn setup(&self) -> Setup<'_> {
Setup::new(&self.db, &self.events)
}
- pub const fn tokens(&self) -> Tokens {
+ pub const fn tokens(&self) -> Tokens<'_> {
Tokens::new(&self.db, &self.token_events)
}
}
diff --git a/src/conversation/repo.rs b/src/conversation/repo.rs
index 82b5f01..e40a5bd 100644
--- a/src/conversation/repo.rs
+++ b/src/conversation/repo.rs
@@ -10,11 +10,11 @@ use crate::{
};
pub trait Provider {
- fn conversations(&mut self) -> Conversations;
+ fn conversations(&mut self) -> Conversations<'_>;
}
impl Provider for Transaction<'_, Sqlite> {
- fn conversations(&mut self) -> Conversations {
+ fn conversations(&mut self) -> Conversations<'_> {
Conversations(self)
}
}
diff --git a/src/event/repo.rs b/src/event/repo.rs
index ab3c449..da27960 100644
--- a/src/event/repo.rs
+++ b/src/event/repo.rs
@@ -6,11 +6,11 @@ use crate::{
};
pub trait Provider {
- fn sequence(&mut self) -> Sequences;
+ fn sequence(&mut self) -> Sequences<'_>;
}
impl Provider for Transaction<'_, Sqlite> {
- fn sequence(&mut self) -> Sequences {
+ fn sequence(&mut self) -> Sequences<'_> {
Sequences(self)
}
}
diff --git a/src/invite/repo.rs b/src/invite/repo.rs
index 79114ec..7cfa18e 100644
--- a/src/invite/repo.rs
+++ b/src/invite/repo.rs
@@ -8,11 +8,11 @@ use crate::{
};
pub trait Provider {
- fn invites(&mut self) -> Invites;
+ fn invites(&mut self) -> Invites<'_>;
}
impl Provider for Transaction<'_, Sqlite> {
- fn invites(&mut self) -> Invites {
+ fn invites(&mut self) -> Invites<'_> {
Invites(self)
}
}
diff --git a/src/message/repo.rs b/src/message/repo.rs
index 9b65a67..b4c086d 100644
--- a/src/message/repo.rs
+++ b/src/message/repo.rs
@@ -9,11 +9,11 @@ use crate::{
};
pub trait Provider {
- fn messages(&mut self) -> Messages;
+ fn messages(&mut self) -> Messages<'_>;
}
impl Provider for Transaction<'_, Sqlite> {
- fn messages(&mut self) -> Messages {
+ fn messages(&mut self) -> Messages<'_> {
Messages(self)
}
}
diff --git a/src/setup/repo.rs b/src/setup/repo.rs
index c4f5fd8..e7c61f2 100644
--- a/src/setup/repo.rs
+++ b/src/setup/repo.rs
@@ -1,11 +1,11 @@
use sqlx::{SqliteConnection, Transaction, sqlite::Sqlite};
pub trait Provider {
- fn setup(&mut self) -> Setup;
+ fn setup(&mut self) -> Setup<'_>;
}
impl Provider for Transaction<'_, Sqlite> {
- fn setup(&mut self) -> Setup {
+ fn setup(&mut self) -> Setup<'_> {
Setup(self)
}
}
diff --git a/src/test/fixtures/future.rs b/src/test/fixtures/future.rs
index c0fa528..86aba53 100644
--- a/src/test/fixtures/future.rs
+++ b/src/test/fixtures/future.rs
@@ -15,7 +15,7 @@ pub trait Expect: Sized {
// and panics with the provided message if it is not.
//
// For stream operations, can be used to assert immediate completion.
- fn expect_ready(self, message: &str) -> Ready<Self>
+ fn expect_ready(self, message: &str) -> Ready<'_, Self>
where
Self: Future;
@@ -26,7 +26,7 @@ pub trait Expect: Sized {
//
// For stream operations, can be used to assert that completion hasn't happened
// yet.
- fn expect_wait(self, message: &str) -> Wait<Self>
+ fn expect_wait(self, message: &str) -> Wait<'_, Self>
where
Self: Future;
@@ -37,7 +37,7 @@ pub trait Expect: Sized {
//
// For stream operations, can be used to assert that the stream has at least one
// message.
- fn expect_some<T>(self, message: &str) -> Some<Self>
+ fn expect_some<T>(self, message: &str) -> Some<'_, Self>
where
Self: Future<Output = Option<T>>;
@@ -47,27 +47,27 @@ pub trait Expect: Sized {
// fixed.
//
// For stream operations, can be used to assert that the stream has ended.
- fn expect_none<T>(self, message: &str) -> None<Self>
+ fn expect_none<T>(self, message: &str) -> None<'_, Self>
where
Self: Future<Output = Option<T>>;
}
impl<St> Expect for stream::Next<'_, St> {
- fn expect_ready(self, message: &str) -> Ready<Self> {
+ fn expect_ready(self, message: &str) -> Ready<'_, Self> {
Ready {
future: self,
message,
}
}
- fn expect_wait(self, message: &str) -> Wait<Self> {
+ fn expect_wait(self, message: &str) -> Wait<'_, Self> {
Wait {
future: self,
message,
}
}
- fn expect_some<T>(self, message: &str) -> Some<Self>
+ fn expect_some<T>(self, message: &str) -> Some<'_, Self>
where
Self: Future<Output = Option<T>>,
{
@@ -77,7 +77,7 @@ impl<St> Expect for stream::Next<'_, St> {
}
}
- fn expect_none<T>(self, message: &str) -> None<Self>
+ fn expect_none<T>(self, message: &str) -> None<'_, Self>
where
Self: Future<Output = Option<T>>,
{
@@ -89,21 +89,21 @@ impl<St> Expect for stream::Next<'_, St> {
}
impl<St, C> Expect for stream::Collect<St, C> {
- fn expect_ready(self, message: &str) -> Ready<Self> {
+ fn expect_ready(self, message: &str) -> Ready<'_, Self> {
Ready {
future: self,
message,
}
}
- fn expect_wait(self, message: &str) -> Wait<Self> {
+ fn expect_wait(self, message: &str) -> Wait<'_, Self> {
Wait {
future: self,
message,
}
}
- fn expect_some<T>(self, message: &str) -> Some<Self>
+ fn expect_some<T>(self, message: &str) -> Some<'_, Self>
where
Self: Future<Output = Option<T>>,
{
@@ -113,7 +113,7 @@ impl<St, C> Expect for stream::Collect<St, C> {
}
}
- fn expect_none<T>(self, message: &str) -> None<Self>
+ fn expect_none<T>(self, message: &str) -> None<'_, Self>
where
Self: Future<Output = Option<T>>,
{
diff --git a/src/token/repo/auth.rs b/src/token/repo/auth.rs
index 68a81c7..5976d4a 100644
--- a/src/token/repo/auth.rs
+++ b/src/token/repo/auth.rs
@@ -9,11 +9,11 @@ use crate::{
};
pub trait Provider {
- fn auth(&mut self) -> Auth;
+ fn auth(&mut self) -> Auth<'_>;
}
impl Provider for Transaction<'_, Sqlite> {
- fn auth(&mut self) -> Auth {
+ fn auth(&mut self) -> Auth<'_> {
Auth(self)
}
}
diff --git a/src/token/repo/token.rs b/src/token/repo/token.rs
index cbc50ab..7ac4ac5 100644
--- a/src/token/repo/token.rs
+++ b/src/token/repo/token.rs
@@ -11,11 +11,11 @@ use crate::{
};
pub trait Provider {
- fn tokens(&mut self) -> Tokens;
+ fn tokens(&mut self) -> Tokens<'_>;
}
impl Provider for Transaction<'_, Sqlite> {
- fn tokens(&mut self) -> Tokens {
+ fn tokens(&mut self) -> Tokens<'_> {
Tokens(self)
}
}
diff --git a/src/user/repo.rs b/src/user/repo.rs
index c02d50f..83a1471 100644
--- a/src/user/repo.rs
+++ b/src/user/repo.rs
@@ -9,11 +9,11 @@ use crate::{
};
pub trait Provider {
- fn users(&mut self) -> Users;
+ fn users(&mut self) -> Users<'_>;
}
impl Provider for Transaction<'_, Sqlite> {
- fn users(&mut self) -> Users {
+ fn users(&mut self) -> Users<'_> {
Users(self)
}
}