[#45] Fixed clippy errors
continuous-integration/drone the build was successful Details

pull/72/head
Jef Roosens 2021-05-11 22:11:35 +02:00
parent c8bfc16af8
commit faa4f713c8
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
3 changed files with 10 additions and 9 deletions

View File

@ -16,10 +16,7 @@ impl PickupTime {
/// * `date` - Date of pickup time
/// * `label` - Type of trash
pub fn new(date: BasicDate, label: String) -> PickupTime {
PickupTime {
date: date,
label: label,
}
PickupTime { date, label }
}
}

View File

@ -8,12 +8,15 @@ fn main() {
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
let db_conn = PgConnection::establish(&database_url)
.expect(&format!("Error connecting to {}", database_url));
.unwrap_or_else(|_| panic!("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);
insert_into(ivago_streets)
.values(streets)
.execute(&db_conn)
.expect("Failed to insert rows.");
}
}
}

View File

@ -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,8 +63,9 @@ fn run_db_migrations(rocket: Rocket) -> Result<Rocket, Rocket> {
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