cargo clippy --fix

rust
Elnu 1 year ago
parent 427b019a49
commit b20fa28198

@ -96,7 +96,7 @@ impl Database {
println!("Adding archived data for user {id}"); println!("Adding archived data for user {id}");
} }
let (name, discriminator) = { let (name, discriminator) = {
let mut iter = legacy.username.split("#"); let mut iter = legacy.username.split('#');
let name = iter.next().unwrap().to_owned(); let name = iter.next().unwrap().to_owned();
let discriminator = iter let discriminator = iter
.next() .next()
@ -118,7 +118,7 @@ impl Database {
// their username/discriminator since their previous submission // their username/discriminator since their previous submission
archive(); archive();
} else { } else {
match User::fetch(&http, submission.author_id).await { match User::fetch(http, submission.author_id).await {
Ok(user) => { Ok(user) => {
self.conn.execute( self.conn.execute(
"INSERT INTO User(id, name, discriminator, avatar) VALUES (?1, ?2, ?3, ?4)", "INSERT INTO User(id, name, discriminator, avatar) VALUES (?1, ?2, ?3, ?4)",

@ -30,10 +30,9 @@ impl LegacySubmission {
// it's a datestamp. // it's a datestamp.
(|| image (|| image
// Get filename without extension // Get filename without extension
.split(".") .split('.').next()?
.nth(0)?
// Get last number // Get last number
.split("-") .split('-')
.last()? .last()?
.parse() .parse()
.ok() .ok()

@ -17,7 +17,7 @@ pub struct Login<'r> {
#[post("/login", data = "<login>")] #[post("/login", data = "<login>")]
pub async fn post_login(login: Form<Login<'_>>, cookies: &CookieJar<'_>) -> Redirect { pub async fn post_login(login: Form<Login<'_>>, 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() && SessionUser::init(login.access_token, cookies).await.is_ok()
{ {
cookies.add(Cookie::new( cookies.add(Cookie::new(

Loading…
Cancel
Save