From b2a9ec9d45f6a68fc08675baaa618b7a7d611343 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Fri, 28 Mar 2025 13:42:41 -0700 Subject: [PATCH] Clean up warnings --- tegakituesday/Cargo.toml | 2 +- tegakituesday/src/i18n.rs | 1 + tegakituesday/src/models/database.rs | 2 ++ tegakituesday/src/models/settings.rs | 1 + .../models/submission/legacy_submission.rs | 1 + tegakituesday/src/models/user/mod.rs | 25 ++++++++++--------- tegakituesday/src/routes/post_login.rs | 2 +- tegakituesday/src/utils/kyujitai.rs | 1 + 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tegakituesday/Cargo.toml b/tegakituesday/Cargo.toml index 4b292bb..e7700b0 100644 --- a/tegakituesday/Cargo.toml +++ b/tegakituesday/Cargo.toml @@ -25,5 +25,5 @@ rocket_dyn_templates = { version = "0.2", features = ["tera"] } rusqlite = { version = "0.34", features = ["chrono"] } serde = "1.0" serde_json = "1.0" -serde_yaml = "0.9.34+deprecated" # deprecated +serde_yaml = "0.9.34" # deprecated tokio = { version = "1.44", features = ["macros", "rt-multi-thread"] } diff --git a/tegakituesday/src/i18n.rs b/tegakituesday/src/i18n.rs index 2e8057a..7f386da 100644 --- a/tegakituesday/src/i18n.rs +++ b/tegakituesday/src/i18n.rs @@ -11,6 +11,7 @@ use std::{ use gettext::Catalog; #[derive(From, Debug)] +#[allow(dead_code)] pub enum LoadCatalogsError { Io(std::io::Error), Parse(gettext::Error), diff --git a/tegakituesday/src/models/database.rs b/tegakituesday/src/models/database.rs index 8496004..1fc80d0 100644 --- a/tegakituesday/src/models/database.rs +++ b/tegakituesday/src/models/database.rs @@ -20,12 +20,14 @@ pub struct Database { const DATABASE_FILENAME: &str = "database.db"; #[derive(From, Debug)] +#[allow(dead_code)] pub enum DatabaseError { Rusqlite(rusqlite::Error), Pool(r2d2::Error), } #[derive(From, Debug)] +#[allow(dead_code)] pub enum GenericError { Database(DatabaseError), Serenity(SerenityError), diff --git a/tegakituesday/src/models/settings.rs b/tegakituesday/src/models/settings.rs index 2bce1bc..9577c56 100644 --- a/tegakituesday/src/models/settings.rs +++ b/tegakituesday/src/models/settings.rs @@ -26,6 +26,7 @@ impl Settings { } #[derive(From, Debug)] +#[allow(dead_code)] pub enum GetSettingsError { Io(std::io::Error), Deserialize(serde_yaml::Error), diff --git a/tegakituesday/src/models/submission/legacy_submission.rs b/tegakituesday/src/models/submission/legacy_submission.rs index 3dd63f4..1b1566a 100644 --- a/tegakituesday/src/models/submission/legacy_submission.rs +++ b/tegakituesday/src/models/submission/legacy_submission.rs @@ -21,6 +21,7 @@ where } #[derive(From, Debug)] +#[allow(dead_code)] pub enum LegacySubmissionParseError { BadAuthorId(std::num::ParseIntError), } diff --git a/tegakituesday/src/models/user/mod.rs b/tegakituesday/src/models/user/mod.rs index 55f3de8..c3ab405 100644 --- a/tegakituesday/src/models/user/mod.rs +++ b/tegakituesday/src/models/user/mod.rs @@ -147,12 +147,12 @@ impl SessionUser { } pub fn purge(cookies: &CookieJar<'_>) { - cookies.remove_private(Cookie::named(TOKEN_COOKIE)); - cookies.remove_private(Cookie::named(USER_ID_COOKIE)); - cookies.remove_private(Cookie::named(USER_NAME_COOKIE)); - cookies.remove_private(Cookie::named(USER_DISCRIMINATOR_COOKIE)); - cookies.remove_private(Cookie::named(USER_AVATAR_COOKIE)); - cookies.remove(Cookie::named(TOKEN_EXPIRE_COOKIE)); + cookies.remove_private(Cookie::from(TOKEN_COOKIE)); + cookies.remove_private(Cookie::from(USER_ID_COOKIE)); + cookies.remove_private(Cookie::from(USER_NAME_COOKIE)); + cookies.remove_private(Cookie::from(USER_DISCRIMINATOR_COOKIE)); + cookies.remove_private(Cookie::from(USER_AVATAR_COOKIE)); + cookies.remove(Cookie::from(TOKEN_EXPIRE_COOKIE)); } fn from_cookies(cookies: &CookieJar<'_>) -> Option { @@ -176,12 +176,12 @@ impl SessionUser { .and_then(Result::ok) .is_none_or(|timestamp| Utc::now().timestamp() >= timestamp) { - cookies.remove_private(Cookie::named(TOKEN_COOKIE)); - cookies.remove_private(Cookie::named(USER_ID_COOKIE)); - cookies.remove_private(Cookie::named(USER_NAME_COOKIE)); - cookies.remove_private(Cookie::named(USER_DISCRIMINATOR_COOKIE)); - cookies.remove_private(Cookie::named(USER_AVATAR_COOKIE)); - cookies.remove(Cookie::named(TOKEN_EXPIRE_COOKIE)); + cookies.remove_private(Cookie::from(TOKEN_COOKIE)); + cookies.remove_private(Cookie::from(USER_ID_COOKIE)); + cookies.remove_private(Cookie::from(USER_NAME_COOKIE)); + cookies.remove_private(Cookie::from(USER_DISCRIMINATOR_COOKIE)); + cookies.remove_private(Cookie::from(USER_AVATAR_COOKIE)); + cookies.remove(Cookie::from(TOKEN_EXPIRE_COOKIE)); return Ok(None); } Ok(Some(user)) @@ -189,6 +189,7 @@ impl SessionUser { } #[derive(From, Debug)] +#[allow(dead_code)] pub enum GetUserError { Reqwest(reqwest::Error), Deserialize(serde_json::Error), diff --git a/tegakituesday/src/routes/post_login.rs b/tegakituesday/src/routes/post_login.rs index 7b9cfdc..00e10ec 100644 --- a/tegakituesday/src/routes/post_login.rs +++ b/tegakituesday/src/routes/post_login.rs @@ -29,7 +29,7 @@ pub async fn post_login(login: Form>, cookies: &CookieJar<'_>) -> Redi .timestamp() .to_string(), )); - cookies.remove(Cookie::named(WELCOMED_COOKIE)); + cookies.remove(Cookie::from(WELCOMED_COOKIE)); } Redirect::to("/") } diff --git a/tegakituesday/src/utils/kyujitai.rs b/tegakituesday/src/utils/kyujitai.rs index d90aad6..b1930fd 100644 --- a/tegakituesday/src/utils/kyujitai.rs +++ b/tegakituesday/src/utils/kyujitai.rs @@ -353,6 +353,7 @@ const KYUJITAI: &[(char, char)] = &[ pub trait Kyujitai { fn to_kyujitai(&self) -> String; + #[allow(dead_code)] fn to_shinjitai(&self) -> String; }