This commit is contained in:
parent
4eac917f2a
commit
836f8934d0
10
src/misc.rs
10
src/misc.rs
@ -70,7 +70,8 @@ impl From<roxmltree::Error> for Error {
|
||||
/// Returns the current date in YYYY-MM-DD format. Needed for RIS API query to get current version of the overview.
|
||||
pub(crate) fn current_date() -> String {
|
||||
let local_date = OffsetDateTime::now_utc();
|
||||
let format = format_description::parse("[year]-[month]-[day]").unwrap(); //unwrap okay, supplied format is fine
|
||||
let format = format_description::parse("[year]-[month]-[day]")
|
||||
.expect("Can't fail, supplied format is fine");
|
||||
local_date.format(&format).expect("Failed to format date")
|
||||
}
|
||||
|
||||
@ -80,7 +81,12 @@ pub(crate) fn get_cache_dir() -> Result<String, Error> {
|
||||
msg: "directories crate could not find basedirs.".into(),
|
||||
})?;
|
||||
let cache_dir = cache_dir.cache_dir();
|
||||
Ok(format!("{}/risp/", cache_dir.to_str().unwrap()))
|
||||
Ok(format!(
|
||||
"{}/risp/",
|
||||
cache_dir
|
||||
.to_str()
|
||||
.ok_or(Error::new("Cache dir can't be found"))?
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Loading…
Reference in New Issue
Block a user