Skip to content

Commit

Permalink
Further refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
RRArny committed Nov 17, 2024
1 parent 9ae7342 commit dcbf4f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ fn read_config_file(config_filepath: Option<String>) -> Config {
.unwrap_or(std::env::var("HOME").expect(msg) + "/.config/wxfetch/config.toml");
let config_file = File::open(config_filepath.clone());
if config_file.is_err() {
println!("Could not open config file at {config_filepath}. Proceeding with defaults...");
return config;
}
let mut config_file = config_file.unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ fn get_secrets(param: Option<String>) -> Secrets {
async fn get_weather(config: &Config, secrets: &Secrets) -> Value {
request_wx(config, secrets)
.await
.expect("Weather request failed.")
.expect("Weather request failed. Check the API key for AvWx and your internet connection. Maybe try another position.")
}

fn get_weather_from_file(filename: String) -> Value {
let file = File::open(filename).expect("No such file: {filename}");
let file = File::open(filename).expect("No such file.");
let reader = BufReader::new(file);
serde_json::from_reader(reader).expect("Failed to read data from file {filename}")
serde_json::from_reader(reader).expect("Failed to read data from file.")
}

#[tokio::main]
Expand Down

0 comments on commit dcbf4f6

Please sign in to comment.