fix warnings, fmt
Some checks failed
Rust / build (push) Has been cancelled

This commit is contained in:
Nick Pegg 2025-09-25 15:13:16 -07:00
parent 39d449889d
commit 35cb7949fd
3 changed files with 25 additions and 27 deletions

View file

@ -19,7 +19,7 @@ pub struct AlbumDir {
impl AlbumDir {
/// Returns an iterator over all images in the album and subalbums
pub fn iter_all_images(&self) -> AlbumImageIter {
pub fn iter_all_images(&self) -> AlbumImageIter<'_> {
AlbumImageIter::new(self)
}
@ -79,8 +79,9 @@ impl AlbumDir {
}
}
}
} else if entry_path.is_dir() {
if let Some(dirname) = entry_path.file_name().and_then(|n| n.to_str()) {
} else if entry_path.is_dir()
&& let Some(dirname) = entry_path.file_name().and_then(|n| n.to_str())
{
if dirname.starts_with("_") {
// Likely a templates or static dir
continue;
@ -94,7 +95,6 @@ impl AlbumDir {
children.push(AlbumDir::from_path(&entry_path, root)?);
}
}
}
children.sort_by_key(|c| c.path.clone());
images.sort_by_key(|i| i.path.clone());

View file

@ -55,8 +55,7 @@ impl Image {
/// return "blah.thumb"
fn slide_filename(path: &Path, ext: &str, keep_ext: bool) -> anyhow::Result<String> {
let mut new_ext: OsString = ext.into();
if keep_ext {
if let Some(e) = path.extension() {
if keep_ext && let Some(e) = path.extension() {
new_ext = OsString::from(
ext.to_string()
+ "."
@ -66,7 +65,6 @@ impl Image {
))?,
)
}
}
let new_path = path.with_extension(new_ext);
let new_name = new_path

View file

@ -1,7 +1,7 @@
use anyhow::{anyhow, Context};
use anyhow::{Context, anyhow};
use image::ImageReader;
use std::ffi::OsStr;
use std::fs::{rename, File};
use std::fs::{File, rename};
use std::io::BufReader;
use std::path::{Path, PathBuf};
use std::str::from_utf8;