From b20fa28198494ca55c2c4e8a13c45596bcee3d2f Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Thu, 29 Jun 2023 22:47:50 -0700 Subject: [PATCH] cargo clippy --fix --- src/models/database.rs | 4 ++-- src/models/submission/legacy_submission.rs | 5 ++--- src/routes/post_login.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/models/database.rs b/src/models/database.rs index b0f3336..8553f0b 100644 --- a/src/models/database.rs +++ b/src/models/database.rs @@ -96,7 +96,7 @@ impl Database { println!("Adding archived data for user {id}"); } let (name, discriminator) = { - let mut iter = legacy.username.split("#"); + let mut iter = legacy.username.split('#'); let name = iter.next().unwrap().to_owned(); let discriminator = iter .next() @@ -118,7 +118,7 @@ impl Database { // their username/discriminator since their previous submission archive(); } else { - match User::fetch(&http, submission.author_id).await { + match User::fetch(http, submission.author_id).await { Ok(user) => { self.conn.execute( "INSERT INTO User(id, name, discriminator, avatar) VALUES (?1, ?2, ?3, ?4)", diff --git a/src/models/submission/legacy_submission.rs b/src/models/submission/legacy_submission.rs index 4df96ca..fcf4008 100644 --- a/src/models/submission/legacy_submission.rs +++ b/src/models/submission/legacy_submission.rs @@ -30,10 +30,9 @@ impl LegacySubmission { // it's a datestamp. (|| image // Get filename without extension - .split(".") - .nth(0)? + .split('.').next()? // Get last number - .split("-") + .split('-') .last()? .parse() .ok() diff --git a/src/routes/post_login.rs b/src/routes/post_login.rs index 1dec00d..568a9e5 100644 --- a/src/routes/post_login.rs +++ b/src/routes/post_login.rs @@ -17,7 +17,7 @@ pub struct Login<'r> { #[post("/login", data = "")] pub async fn post_login(login: Form>, cookies: &CookieJar<'_>) -> Redirect { - if (login.token_type != "Bearer" || login.scope.split("+").any(|scope| scope == "identify")) + if (login.token_type != "Bearer" || login.scope.split('+').any(|scope| scope == "identify")) && SessionUser::init(login.access_token, cookies).await.is_ok() { cookies.add(Cookie::new(