fix clippy warnings

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-04-19 14:30:08 -07:00
parent a71e8206fb
commit 99ac578ebd
11 changed files with 88 additions and 89 deletions

View File

@@ -26,8 +26,12 @@ impl ImageCache {
}
pub fn write(cache_dir: &path::Path, url: &str, data: ColorImage) -> Result<()> {
let file_path = cache_dir.join(&Self::key(url));
let file = File::options().write(true).create(true).open(file_path)?;
let file_path = cache_dir.join(Self::key(url));
let file = File::options()
.write(true)
.create(true)
.truncate(true)
.open(file_path)?;
let encoder = image::codecs::webp::WebPEncoder::new_lossless(file);
encoder.encode(