From 0c01bd4cf8b05bc46848ea07e6ad52bb4adeebd5 Mon Sep 17 00:00:00 2001 From: Erb3 <49862976+Erb3@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:28:25 +0200 Subject: [PATCH] refactor: include cities in build --- src/datasource.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/datasource.rs b/src/datasource.rs index 0fc0216..95896b2 100644 --- a/src/datasource.rs +++ b/src/datasource.rs @@ -1,5 +1,4 @@ use serde::{Deserialize, Serialize}; -use tokio::fs; #[derive(Deserialize, Serialize, Clone)] pub struct City { @@ -16,8 +15,6 @@ pub struct AnonymizedCity<'a> { } pub async fn get_cities() -> Vec { - let cities_str = fs::read_to_string("./cities.json") - .await - .expect("Unable to read cities.json file."); - serde_json::from_str(&cities_str).expect("cities.json does not have correct format.") + serde_json::from_str(include_str!("../cities.json")) + .expect("cities.json does not have correct format.") }