Clean up warnings
This commit is contained in:
parent
d03095dbc3
commit
b2a9ec9d45
8 changed files with 21 additions and 14 deletions
|
@ -25,5 +25,5 @@ rocket_dyn_templates = { version = "0.2", features = ["tera"] }
|
||||||
rusqlite = { version = "0.34", features = ["chrono"] }
|
rusqlite = { version = "0.34", features = ["chrono"] }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_json = "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"] }
|
tokio = { version = "1.44", features = ["macros", "rt-multi-thread"] }
|
||||||
|
|
|
@ -11,6 +11,7 @@ use std::{
|
||||||
use gettext::Catalog;
|
use gettext::Catalog;
|
||||||
|
|
||||||
#[derive(From, Debug)]
|
#[derive(From, Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum LoadCatalogsError {
|
pub enum LoadCatalogsError {
|
||||||
Io(std::io::Error),
|
Io(std::io::Error),
|
||||||
Parse(gettext::Error),
|
Parse(gettext::Error),
|
||||||
|
|
|
@ -20,12 +20,14 @@ pub struct Database {
|
||||||
const DATABASE_FILENAME: &str = "database.db";
|
const DATABASE_FILENAME: &str = "database.db";
|
||||||
|
|
||||||
#[derive(From, Debug)]
|
#[derive(From, Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum DatabaseError {
|
pub enum DatabaseError {
|
||||||
Rusqlite(rusqlite::Error),
|
Rusqlite(rusqlite::Error),
|
||||||
Pool(r2d2::Error),
|
Pool(r2d2::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(From, Debug)]
|
#[derive(From, Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum GenericError {
|
pub enum GenericError {
|
||||||
Database(DatabaseError),
|
Database(DatabaseError),
|
||||||
Serenity(SerenityError),
|
Serenity(SerenityError),
|
||||||
|
|
|
@ -26,6 +26,7 @@ impl Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(From, Debug)]
|
#[derive(From, Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum GetSettingsError {
|
pub enum GetSettingsError {
|
||||||
Io(std::io::Error),
|
Io(std::io::Error),
|
||||||
Deserialize(serde_yaml::Error),
|
Deserialize(serde_yaml::Error),
|
||||||
|
|
|
@ -21,6 +21,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(From, Debug)]
|
#[derive(From, Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum LegacySubmissionParseError {
|
pub enum LegacySubmissionParseError {
|
||||||
BadAuthorId(std::num::ParseIntError),
|
BadAuthorId(std::num::ParseIntError),
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,12 +147,12 @@ impl SessionUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn purge(cookies: &CookieJar<'_>) {
|
pub fn purge(cookies: &CookieJar<'_>) {
|
||||||
cookies.remove_private(Cookie::named(TOKEN_COOKIE));
|
cookies.remove_private(Cookie::from(TOKEN_COOKIE));
|
||||||
cookies.remove_private(Cookie::named(USER_ID_COOKIE));
|
cookies.remove_private(Cookie::from(USER_ID_COOKIE));
|
||||||
cookies.remove_private(Cookie::named(USER_NAME_COOKIE));
|
cookies.remove_private(Cookie::from(USER_NAME_COOKIE));
|
||||||
cookies.remove_private(Cookie::named(USER_DISCRIMINATOR_COOKIE));
|
cookies.remove_private(Cookie::from(USER_DISCRIMINATOR_COOKIE));
|
||||||
cookies.remove_private(Cookie::named(USER_AVATAR_COOKIE));
|
cookies.remove_private(Cookie::from(USER_AVATAR_COOKIE));
|
||||||
cookies.remove(Cookie::named(TOKEN_EXPIRE_COOKIE));
|
cookies.remove(Cookie::from(TOKEN_EXPIRE_COOKIE));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_cookies(cookies: &CookieJar<'_>) -> Option<Self> {
|
fn from_cookies(cookies: &CookieJar<'_>) -> Option<Self> {
|
||||||
|
@ -176,12 +176,12 @@ impl SessionUser {
|
||||||
.and_then(Result::ok)
|
.and_then(Result::ok)
|
||||||
.is_none_or(|timestamp| Utc::now().timestamp() >= timestamp)
|
.is_none_or(|timestamp| Utc::now().timestamp() >= timestamp)
|
||||||
{
|
{
|
||||||
cookies.remove_private(Cookie::named(TOKEN_COOKIE));
|
cookies.remove_private(Cookie::from(TOKEN_COOKIE));
|
||||||
cookies.remove_private(Cookie::named(USER_ID_COOKIE));
|
cookies.remove_private(Cookie::from(USER_ID_COOKIE));
|
||||||
cookies.remove_private(Cookie::named(USER_NAME_COOKIE));
|
cookies.remove_private(Cookie::from(USER_NAME_COOKIE));
|
||||||
cookies.remove_private(Cookie::named(USER_DISCRIMINATOR_COOKIE));
|
cookies.remove_private(Cookie::from(USER_DISCRIMINATOR_COOKIE));
|
||||||
cookies.remove_private(Cookie::named(USER_AVATAR_COOKIE));
|
cookies.remove_private(Cookie::from(USER_AVATAR_COOKIE));
|
||||||
cookies.remove(Cookie::named(TOKEN_EXPIRE_COOKIE));
|
cookies.remove(Cookie::from(TOKEN_EXPIRE_COOKIE));
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
Ok(Some(user))
|
Ok(Some(user))
|
||||||
|
@ -189,6 +189,7 @@ impl SessionUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(From, Debug)]
|
#[derive(From, Debug)]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum GetUserError {
|
pub enum GetUserError {
|
||||||
Reqwest(reqwest::Error),
|
Reqwest(reqwest::Error),
|
||||||
Deserialize(serde_json::Error),
|
Deserialize(serde_json::Error),
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub async fn post_login(login: Form<Login<'_>>, cookies: &CookieJar<'_>) -> Redi
|
||||||
.timestamp()
|
.timestamp()
|
||||||
.to_string(),
|
.to_string(),
|
||||||
));
|
));
|
||||||
cookies.remove(Cookie::named(WELCOMED_COOKIE));
|
cookies.remove(Cookie::from(WELCOMED_COOKIE));
|
||||||
}
|
}
|
||||||
Redirect::to("/")
|
Redirect::to("/")
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,6 +353,7 @@ const KYUJITAI: &[(char, char)] = &[
|
||||||
|
|
||||||
pub trait Kyujitai {
|
pub trait Kyujitai {
|
||||||
fn to_kyujitai(&self) -> String;
|
fn to_kyujitai(&self) -> String;
|
||||||
|
#[allow(dead_code)]
|
||||||
fn to_shinjitai(&self) -> String;
|
fn to_shinjitai(&self) -> String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue