diff options
author | Adam <56338480+adastx@users.noreply.github.com> | 2022-07-27 19:18:55 +0200 |
---|---|---|
committer | Adam <56338480+adastx@users.noreply.github.com> | 2022-07-27 19:18:55 +0200 |
commit | 385cd534348bab30d7b11345baad74c22bf5a426 (patch) | |
tree | f306113ae4687c9a922c79a71a70c3f41062ca63 | |
parent | 9f4bd32ba37ef9cb38831b39d37ca854cd1bda4d (diff) |
Simplified read_file functionmain
-rw-r--r-- | src/main.rs | 6 |
1 files 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( |