diff --git a/src/models/challenge.rs b/src/models/challenge.rs index 7afbaca..758b435 100644 --- a/src/models/challenge.rs +++ b/src/models/challenge.rs @@ -35,7 +35,7 @@ impl Challenge { .expect("Couldn't find challenge file"); let root = parse_document( &arena, - &(challenge_text.clone() + &(challenge_text // comrak can't find frontmatter if there's only frontmatter and no newline at end // TODO: Open issue in comrak + "\n"), diff --git a/src/models/database.rs b/src/models/database.rs index 8f27e26..49fb316 100644 --- a/src/models/database.rs +++ b/src/models/database.rs @@ -88,7 +88,7 @@ impl Database { // HashMap of archived users that are no longer sharing a server with 字ちゃん // Their historical usernames and discriminators will be used 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 { println!("Loading legacy challenge {n}/{latest_challenge}..."); let mut file = File::open(format!("data/challenges/{n}.json")).unwrap(); @@ -123,7 +123,7 @@ impl Database { conn.execute( "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] - ).map_err(|error| DatabaseError::Rusqlite(error))?; + ).map_err(DatabaseError::Rusqlite)?; }, Err(error) if error.to_string().eq("Unknown User") => { // This will also be called in the case of an invalid user ID @@ -148,7 +148,7 @@ impl Database { &submission.image, n, ] - ).map_err(|error| DatabaseError::Rusqlite(error))?; + ).map_err(DatabaseError::Rusqlite)?; } } } @@ -156,7 +156,7 @@ impl Database { conn.execute( "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] - ).map_err(|error| DatabaseError::Rusqlite(error))?; + ).map_err(DatabaseError::Rusqlite)?; } Ok(()) }