summaryrefslogtreecommitdiff
path: root/src/login/create.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-02-21 17:10:49 -0500
committerOwen Jacobson <owen@grimoire.ca>2025-02-21 17:10:49 -0500
commit36cadfe00cacc6a6523f9862d3f7a08a9d0ce611 (patch)
treed53cdf873fb6ac2628be0b04c3e1d7847646b6fb /src/login/create.rs
parentc49c7184f69c6ec7a050679116f0d55623d80af1 (diff)
Ensure `must_use` warnings fire even after results are unwrapped.
Diffstat (limited to 'src/login/create.rs')
-rw-r--r--src/login/create.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/login/create.rs b/src/login/create.rs
index c4cb2bb..c5cea08 100644
--- a/src/login/create.rs
+++ b/src/login/create.rs
@@ -1,12 +1,13 @@
-use sqlx::{Transaction, sqlite::Sqlite};
+use sqlx::{sqlite::Sqlite, Transaction};
-use super::{History, Password, password::StoredHash, repo::Provider as _, validate};
+use super::{password::StoredHash, repo::Provider as _, validate, History, Password};
use crate::{
clock::DateTime,
- event::{Broadcaster, Event, repo::Provider as _},
+ event::{repo::Provider as _, Broadcaster, Event},
name::Name,
};
+#[must_use = "dropping a login creation attempt is likely a mistake"]
pub struct Create<'a> {
name: &'a Name,
password: &'a Password,
@@ -14,7 +15,6 @@ pub struct Create<'a> {
}
impl<'a> Create<'a> {
- #[must_use = "dropping a login creation attempt is likely a mistake"]
pub fn begin(name: &'a Name, password: &'a Password, created_at: &'a DateTime) -> Self {
Self {
name,
@@ -23,7 +23,6 @@ impl<'a> Create<'a> {
}
}
- #[must_use = "dropping a login creation attempt is likely a mistake"]
pub fn validate(self) -> Result<Validated<'a>, Error> {
let Self {
name,
@@ -45,6 +44,7 @@ impl<'a> Create<'a> {
}
}
+#[must_use = "dropping a login creation attempt is likely a mistake"]
pub struct Validated<'a> {
name: &'a Name,
password_hash: StoredHash,
@@ -52,7 +52,6 @@ pub struct Validated<'a> {
}
impl Validated<'_> {
- #[must_use = "dropping a login creation attempt is likely a mistake"]
pub async fn store(self, tx: &mut Transaction<'_, Sqlite>) -> Result<Stored, sqlx::Error> {
let Self {
name,
@@ -67,6 +66,7 @@ impl Validated<'_> {
}
}
+#[must_use = "dropping a login creation attempt is likely a mistake"]
pub struct Stored {
login: History,
}