From 83e86b78d95129c1a6d45b0352f92842da6efedf Mon Sep 17 00:00:00 2001 From: Sebastien Iooss Date: Fri, 12 Jan 2024 12:01:45 +0100 Subject: [PATCH] style: remove non-existing section in the readme and format code --- Readme.md | 1 - src/infrastructure_services/db.rs | 31 +++++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Readme.md b/Readme.md index 17d57bc..63b59f2 100644 --- a/Readme.md +++ b/Readme.md @@ -13,7 +13,6 @@ - [Technology stack](#technology-stack) - [CI](#ci) - [Test](#test) - - [TODO](#todo) Solution of the [developer-test](https://github.com/lioncowlionant/developer-test). diff --git a/src/infrastructure_services/db.rs b/src/infrastructure_services/db.rs index a0502b7..02c78cb 100644 --- a/src/infrastructure_services/db.rs +++ b/src/infrastructure_services/db.rs @@ -63,20 +63,23 @@ pub async fn get_routes_from_db(db_path: &Path) -> Result> { .await .context(format!("Unable to connect the the database at {db_path}"))?; - let routes: Vec = sqlx::query_as!(RouteDB, "SELECT origin, destination, travel_time FROM ROUTES") - .fetch_all(&pool) - .await? - .into_iter() - .filter_map( - |d| match d.try_into().context("Issue reading route in the database") { - Ok(v) => Some(v), - Err(e) => { - println!("{e:#?}"); - None - } - }, - ) - .collect(); + let routes: Vec = sqlx::query_as!( + RouteDB, + "SELECT origin, destination, travel_time FROM ROUTES" + ) + .fetch_all(&pool) + .await? + .into_iter() + .filter_map( + |d| match d.try_into().context("Issue reading route in the database") { + Ok(v) => Some(v), + Err(e) => { + println!("{e:#?}"); + None + } + }, + ) + .collect(); Ok(routes) }