From 385cd534348bab30d7b11345baad74c22bf5a426 Mon Sep 17 00:00:00 2001 From: Adam <56338480+adastx@users.noreply.github.com> Date: Wed, 27 Jul 2022 19:18:55 +0200 Subject: Simplified read_file function --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index f63816b..afedb8c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use serde_json::Value; -use std::{fs, path::Path}; +use std::fs; const CONFIG_PATH: &str = "/home/adam/.config/forecast"; @@ -38,8 +38,8 @@ fn setup() -> (String, String) { } fn read_file(file_name: &str) -> String { - let path = Path::new(CONFIG_PATH).join(file_name); - fs::read_to_string(path.to_string_lossy().to_string()).unwrap() + let path = CONFIG_PATH.to_owned() + "/" + file_name; + fs::read_to_string(path).unwrap() } fn request_weather( -- cgit v1.2.3-70-g09d2