From bf38e03e5c282f2a183ea75240f79f7891d892b3 Mon Sep 17 00:00:00 2001 From: Kyler Chin <7539174+kylerchin@users.noreply.github.com> Date: Mon, 28 Oct 2024 13:31:36 -0700 Subject: [PATCH] decode correctly --- src/birch/get_vehicle_trip_information.rs | 4 +- src/birch/nearby_departures.rs | 13 ++---- src/maple/gtfs_handlers/colour_correction.rs | 8 ++-- src/maple/transitland_download.rs | 4 +- src/osm_extractor/main.rs | 49 ++++++++++---------- 5 files changed, 34 insertions(+), 44 deletions(-) diff --git a/src/birch/get_vehicle_trip_information.rs b/src/birch/get_vehicle_trip_information.rs index e9ea1b1..19bcabc 100644 --- a/src/birch/get_vehicle_trip_information.rs +++ b/src/birch/get_vehicle_trip_information.rs @@ -356,9 +356,7 @@ pub async fn get_trip_rt_update( let find_trip = get_trip.iter().find(|each_update| { matches!( each_update.trip.start_time.as_ref().map( - |start_time| { - start_time == query_start_time - } + |start_time| { start_time == query_start_time } ), Some(true) ) diff --git a/src/birch/nearby_departures.rs b/src/birch/nearby_departures.rs index 142051e..99a398c 100644 --- a/src/birch/nearby_departures.rs +++ b/src/birch/nearby_departures.rs @@ -678,18 +678,13 @@ pub async fn nearby_from_coords( ) .await; - - if let Ok(etcd_data) = etcd_data { if let Some(first_value) = etcd_data.kvs().first() { - let this_chateau_metadata = bincode::deserialize::( - first_value.value(), - ) - .unwrap(); - } + let this_chateau_metadata = + bincode::deserialize::(first_value.value()).unwrap(); - chateau_metadata.insert(chateau_id.clone(), this_chateau_metadata); - + chateau_metadata.insert(chateau_id.clone(), this_chateau_metadata); + } } } diff --git a/src/maple/gtfs_handlers/colour_correction.rs b/src/maple/gtfs_handlers/colour_correction.rs index 04db93b..88f7d60 100644 --- a/src/maple/gtfs_handlers/colour_correction.rs +++ b/src/maple/gtfs_handlers/colour_correction.rs @@ -34,11 +34,9 @@ pub fn fix_background_colour_rgb_feed_route( _ => fix_background_colour_rgb(background), }, - "f-ez-renfeoperadora" => { - match route.short_name.as_deref() { - Some("AVE") => RGB::new(214, 5, 95), - _ => RGB::new(184, 183, 189) - } + "f-ez-renfeoperadora" => match route.short_name.as_deref() { + Some("AVE") => RGB::new(214, 5, 95), + _ => RGB::new(184, 183, 189), }, "f-9q5b-longbeachtransit" => { match route.id.as_str() { diff --git a/src/maple/transitland_download.rs b/src/maple/transitland_download.rs index 57b968a..a5a6048 100644 --- a/src/maple/transitland_download.rs +++ b/src/maple/transitland_download.rs @@ -389,11 +389,11 @@ fn add_auth_headers(request: RequestBuilder, feed_id: &str) -> RequestBuilder { "api_key", "3be3d48087754c4998e6b33b65ec9700".parse().unwrap(), ); - }, + } "f-rb6b-metrochristchurch" => { headers.insert( "Ocp-Apim-Subscription-Key", - "286e6dff5afe4565a08f3d453f8d28e2".parse().unwrap() + "286e6dff5afe4565a08f3d453f8d28e2".parse().unwrap(), ); } _ => {} diff --git a/src/osm_extractor/main.rs b/src/osm_extractor/main.rs index 89c4a3b..48be8fe 100644 --- a/src/osm_extractor/main.rs +++ b/src/osm_extractor/main.rs @@ -41,31 +41,30 @@ async fn main() -> Result<(), Box> { let file_list = [ "north-america/canada/quebec", "europe/france/alsace", - "europe/france/aquitaine", - "europe/france/auvergne", - "europe/france/basse-normandie", - "europe/france/bourgogne", - "europe/france/bretagne", - "europe/france/centre", - "europe/france/champagne-ardenne", - "europe/france/corse", - "europe/france/franche-comte", - "europe/france/haute-normandie", - "europe/france/ile-de-france", - "europe/france/languedoc-roussillon", - "europe/france/limousin", - "europe/france/lorraine", - "europe/france/midi-pyrenees", - "europe/france/nord-pas-de-calais", - "europe/france/pays-de-la-loire", - "europe/france/picardie", - "europe/france/poitou-charentes", - "europe/france/provence-alpes-cote-d-azur", - "europe/france/rhone-alpes", - "europe/switzerland", - "europe/germany", - "europe/austria" - //"north-america/canada/new-brunswick" + "europe/france/aquitaine", + "europe/france/auvergne", + "europe/france/basse-normandie", + "europe/france/bourgogne", + "europe/france/bretagne", + "europe/france/centre", + "europe/france/champagne-ardenne", + "europe/france/corse", + "europe/france/franche-comte", + "europe/france/haute-normandie", + "europe/france/ile-de-france", + "europe/france/languedoc-roussillon", + "europe/france/limousin", + "europe/france/lorraine", + "europe/france/midi-pyrenees", + "europe/france/nord-pas-de-calais", + "europe/france/pays-de-la-loire", + "europe/france/picardie", + "europe/france/poitou-charentes", + "europe/france/provence-alpes-cote-d-azur", + "europe/france/rhone-alpes", + "europe/switzerland", + "europe/germany", + "europe/austria", //"north-america/canada/new-brunswick" ]; for file_name in file_list {