cargo clippy --fix

rust
Elnu 1 year ago
parent a048d313bf
commit 2794359218

@ -35,7 +35,7 @@ impl Challenge {
.expect("Couldn't find challenge file"); .expect("Couldn't find challenge file");
let root = parse_document( let root = parse_document(
&arena, &arena,
&(challenge_text.clone() &(challenge_text
// comrak can't find frontmatter if there's only frontmatter and no newline at end // comrak can't find frontmatter if there's only frontmatter and no newline at end
// TODO: Open issue in comrak // TODO: Open issue in comrak
+ "\n"), + "\n"),

@ -88,7 +88,7 @@ impl Database {
// HashMap of archived users that are no longer sharing a server with 字ちゃん // HashMap of archived users that are no longer sharing a server with 字ちゃん
// Their historical usernames and discriminators will be used // Their historical usernames and discriminators will be used
let mut archived_users = HashMap::new(); let mut archived_users = HashMap::new();
let conn = self.conn().map_err(|error| DatabaseError::Pool(error))?; let conn = self.conn().map_err(DatabaseError::Pool)?;
for n in 1..=latest_challenge { for n in 1..=latest_challenge {
println!("Loading legacy challenge {n}/{latest_challenge}..."); println!("Loading legacy challenge {n}/{latest_challenge}...");
let mut file = File::open(format!("data/challenges/{n}.json")).unwrap(); let mut file = File::open(format!("data/challenges/{n}.json")).unwrap();
@ -123,7 +123,7 @@ impl Database {
conn.execute( conn.execute(
"INSERT INTO User(id, name, discriminator, avatar, deleted) VALUES (?1, ?2, ?3, ?4, ?5)", "INSERT INTO User(id, name, discriminator, avatar, deleted) VALUES (?1, ?2, ?3, ?4, ?5)",
params![user.id, user.name, user.discriminator, user.avatar, user.deleted] params![user.id, user.name, user.discriminator, user.avatar, user.deleted]
).map_err(|error| DatabaseError::Rusqlite(error))?; ).map_err(DatabaseError::Rusqlite)?;
}, },
Err(error) if error.to_string().eq("Unknown User") => { Err(error) if error.to_string().eq("Unknown User") => {
// This will also be called in the case of an invalid user ID // This will also be called in the case of an invalid user ID
@ -148,7 +148,7 @@ impl Database {
&submission.image, &submission.image,
n, n,
] ]
).map_err(|error| DatabaseError::Rusqlite(error))?; ).map_err(DatabaseError::Rusqlite)?;
} }
} }
} }
@ -156,7 +156,7 @@ impl Database {
conn.execute( conn.execute(
"INSERT INTO USER (id, name, discriminator, avatar, deleted) VALUES (?1, ?2, ?3, ?4, ?5)", "INSERT INTO USER (id, name, discriminator, avatar, deleted) VALUES (?1, ?2, ?3, ?4, ?5)",
params![user.id, user.name, user.discriminator, user.avatar, user.deleted] params![user.id, user.name, user.discriminator, user.avatar, user.deleted]
).map_err(|error| DatabaseError::Rusqlite(error))?; ).map_err(DatabaseError::Rusqlite)?;
} }
Ok(()) Ok(())
} }

Loading…
Cancel
Save