Skip to content

Commit

Permalink
chore: appease clippy and cargo check
Browse files Browse the repository at this point in the history
  • Loading branch information
liv committed Apr 26, 2023
1 parent 8d8dc5b commit f026266
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,11 @@ impl LocalAsset {
details,
});
}
} else {
if let Err(details) = fs::remove_file(&dest_path) {
return Err(AxoassetError::LocalAssetRemoveFailed {
dest_path: dest_path.display().to_string(),
details,
});
}
} else if let Err(details) = fs::remove_file(&dest_path) {
return Err(AxoassetError::LocalAssetRemoveFailed {
dest_path: dest_path.display().to_string(),
details,
});
}

Ok(())
Expand Down
6 changes: 3 additions & 3 deletions tests/local_remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ fn it_removes_both_file_and_directory() {
let file_path = Path::new(&dest.as_os_str()).join("subdir").join("test.md");
let dir_path = Path::new(&dest.as_os_str()).join("subdir");

fs::create_dir_all(&file_path.parent().unwrap());
fs::create_dir_all(&file_path.parent().unwrap()).unwrap();
fs::write(&file_path, "hello").unwrap();

axoasset::LocalAsset::remove(&file_path.display().to_string());
axoasset::LocalAsset::remove(&file_path.display().to_string()).unwrap();
assert!(!file_path.exists());

axoasset::LocalAsset::remove(&dir_path.display().to_string());
axoasset::LocalAsset::remove(&dir_path.display().to_string()).unwrap();
assert!(!dir_path.exists());
}

0 comments on commit f026266

Please sign in to comment.