diff --git a/.woodpecker.yml b/.woodpecker.yml index 12ebf7c..4d975b8 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -30,13 +30,6 @@ pipeline: - cargo build - # =====TESTING===== - test-backend: - image: chewingbever/fej-builder:latest - commands: - - cargo test - - # =====LINTING===== lint-frontend: image: node:15-alpine3.13 @@ -52,6 +45,13 @@ pipeline: - cargo fmt -- --check # This is run here because it requires compilation - cargo clippy -- -D warnings + + + # =====TESTING===== + test-backend: + image: chewingbever/fej-builder:latest + commands: + - cargo test # =====REBUILD & FLUSH CACHE===== diff --git a/src/fej/ivago/pickup_time.rs b/src/fej/ivago/pickup_time.rs index 19031fb..f70cbcf 100644 --- a/src/fej/ivago/pickup_time.rs +++ b/src/fej/ivago/pickup_time.rs @@ -16,7 +16,10 @@ impl PickupTime { /// * `date` - Date of pickup time /// * `label` - Type of trash pub fn new(date: BasicDate, label: String) -> PickupTime { - PickupTime { date, label } + PickupTime { + date: date, + label: label, + } } } diff --git a/src/populate_ivago.rs b/src/populate_ivago.rs index 0886551..9dfc876 100644 --- a/src/populate_ivago.rs +++ b/src/populate_ivago.rs @@ -8,15 +8,12 @@ fn main() { let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set"); let db_conn = PgConnection::establish(&database_url) - .unwrap_or_else(|_| panic!("Error connecting to {}", database_url)); + .expect(&format!("Error connecting to {}", database_url)); // Doing this linearly is good enough I'd say for c in ABC.chars() { if let Ok(streets) = search_streets(&c.to_string()) { - insert_into(ivago_streets) - .values(streets) - .execute(&db_conn) - .expect("Failed to insert rows."); + insert_into(ivago_streets).values(streets).execute(&db_conn); } } } diff --git a/src/server/main.rs b/src/server/main.rs index bfe4fef..2a5bd2f 100644 --- a/src/server/main.rs +++ b/src/server/main.rs @@ -23,9 +23,9 @@ use rocket_contrib::databases::diesel; #[cfg(feature = "frontend")] use rocket_contrib::serve::StaticFiles; -pub struct Cors; +pub struct CORS; -impl Fairing for Cors { +impl Fairing for CORS { fn info(&self) -> Info { Info { name: "Add CORS headers to responses", @@ -63,9 +63,8 @@ fn run_db_migrations(rocket: Rocket) -> Result { fn rocket() -> rocket::Rocket { // This needs to be muted for the frontend feature - #[allow(unused_mut)] let mut rocket = rocket::ignite() - .attach(Cors) + .attach(CORS) .attach(FejDbConn::fairing()) .attach(AdHoc::on_attach("Database Migrations", run_db_migrations)) .mount("/api/ivago", routes::ivago()) // /api being hardcoded is temporary