Clippy fixes

main
Johannes Wünsche 2022-03-05 09:28:33 +01:00
parent 3721f1f8e6
commit 02989c40c8
Signed by: johannes
GPG Key ID: 2511CF80B7C283AB
2 changed files with 7 additions and 8 deletions

View File

@ -38,15 +38,14 @@ fn main() -> Result<()> {
.value_of(INPUT)
.ok_or_else(|| anyhow::Error::msg("Could not read INPUT"))?;
let parent_directory;
if matches.is_present(DIR) {
let parent_directory = if matches.is_present(DIR) {
let nu_path = std::path::Path::new(matches.value_of(DIR).unwrap()).to_path_buf();
if !nu_path.exists() {
std::fs::create_dir_all(&nu_path)?
}
parent_directory = nu_path.canonicalize()?;
nu_path.canonicalize()?
} else {
parent_directory = std::path::Path::new(path)
std::path::Path::new(path)
.canonicalize()
.map_err(|e| {
anyhow::Error::msg(format!("Cannot get absolute path of the given file: {}", e))
@ -59,8 +58,8 @@ fn main() -> Result<()> {
path
))
})?
.to_path_buf();
}
.to_path_buf()
};
let image_ctx = HeifContext::read_from_file(path)?;
// FETCH file wide metadata

View File

@ -44,13 +44,13 @@ pub fn get_wallpaper_metadata(image_ctx: &HeifContext) -> Option<WallPaperMode>
.for_each(|att| match att.as_ref().unwrap().key {
s if s == "apple_desktop:h24".as_bytes() => {
h24 = Some(WallPaperMode::H24(
String::from_utf8_lossy(&att.unwrap().value.into_owned())
String::from_utf8_lossy(&att.unwrap().value)
.to_string(),
))
}
s if s == "apple_desktop:solar".as_bytes() => {
h24 = Some(WallPaperMode::Solar(
String::from_utf8_lossy(&att.unwrap().value.into_owned())
String::from_utf8_lossy(&att.unwrap().value)
.to_string(),
))
}