Correct stdout, updating lib and some clippy clean
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-07-30 18:13:42 +02:00
parent fd4affdb17
commit 1affcb9d1a
10 changed files with 117 additions and 138 deletions
+3 -6
View File
@@ -1,7 +1,7 @@
use std::{
fs::{create_dir_all, File},
io::{Read, Write},
path::PathBuf,
path::{Path, PathBuf},
};
use crate::ip_api::ip_location::IpLocation;
@@ -60,15 +60,13 @@ pub fn get_from_cache(ip: &str) -> Option<IpLocation> {
}
}
fn is_in_cache(path: &PathBuf) -> bool {
fn is_in_cache(path: &Path) -> bool {
path.is_file()
}
fn get_cache_dir() -> Option<PathBuf> {
let dir = ProjectDirs::from("com", "midefos", "open-meteo-cli");
if dir.is_some() {
let project_dir = dir.unwrap();
if let Some(project_dir) = &dir {
let cache_dir = project_dir.cache_dir();
if !cache_dir.exists() {
let res = create_dir_all(cache_dir);
@@ -76,7 +74,6 @@ fn get_cache_dir() -> Option<PathBuf> {
return None;
}
}
Some(cache_dir.to_owned())
} else {
None