style: cargo fmt sweep

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron Cordes
2026-05-01 19:01:00 -04:00
parent 1d9b9a0bc4
commit fb4df4b195
6 changed files with 77 additions and 71 deletions
+35 -24
View File
@@ -350,7 +350,11 @@ pub fn run_orphan_gc(
// ("revived"). Common case: a network share that briefly went
// stale comes back, image_exif gets re-populated by ingest, and
// the hash is no longer orphaned.
let revived = state.pending.difference(&orphans).cloned().collect::<Vec<_>>();
let revived = state
.pending
.difference(&orphans)
.cloned()
.collect::<Vec<_>>();
if !revived.is_empty() {
for h in &revived {
state.pending.remove(h);
@@ -438,7 +442,10 @@ pub fn run_orphan_gc(
state.pending.len(),
);
} else {
debug!("orphan-gc: no changes this tick (pending: {})", state.pending.len());
debug!(
"orphan-gc: no changes this tick (pending: {})",
state.pending.len()
);
}
stats
@@ -458,12 +465,7 @@ pub fn all_libraries_online(libs: &[Library], health: &LibraryHealthMap) -> bool
let guard = health.read().unwrap_or_else(|e| e.into_inner());
libs.iter()
.filter(|lib| lib.enabled)
.all(|lib| {
guard
.get(&lib.id)
.map(|h| h.is_online())
.unwrap_or(false)
})
.all(|lib| guard.get(&lib.id).map(|h| h.is_online()).unwrap_or(false))
}
#[derive(QueryableByName, Debug)]
@@ -504,18 +506,15 @@ fn delete_hash_keyed_rows(
use crate::database::schema::{face_detections, photo_insights, tagged_photo};
let faces = diesel::delete(
face_detections::table.filter(face_detections::content_hash.eq_any(hashes)),
)
.execute(conn)?;
let tags = diesel::delete(
tagged_photo::table.filter(tagged_photo::content_hash.eq_any(hashes)),
)
.execute(conn)?;
let insights = diesel::delete(
photo_insights::table.filter(photo_insights::content_hash.eq_any(hashes)),
)
.execute(conn)?;
let faces =
diesel::delete(face_detections::table.filter(face_detections::content_hash.eq_any(hashes)))
.execute(conn)?;
let tags =
diesel::delete(tagged_photo::table.filter(tagged_photo::content_hash.eq_any(hashes)))
.execute(conn)?;
let insights =
diesel::delete(photo_insights::table.filter(photo_insights::content_hash.eq_any(hashes)))
.execute(conn)?;
Ok((faces, tags, insights))
}
@@ -605,7 +604,10 @@ mod tests {
n: i64,
}
fn count(conn: &mut SqliteConnection, sql: &str) -> i64 {
diesel::sql_query(sql).get_result::<CountRow>(conn).unwrap().n
diesel::sql_query(sql)
.get_result::<CountRow>(conn)
.unwrap()
.n
}
#[test]
@@ -731,9 +733,18 @@ mod tests {
assert_eq!(stats.deleted_tagged_photo, 1);
assert_eq!(stats.deleted_photo_insights, 1);
assert_eq!(count(&mut conn, "SELECT COUNT(*) AS n FROM face_detections"), 0);
assert_eq!(count(&mut conn, "SELECT COUNT(*) AS n FROM tagged_photo"), 0);
assert_eq!(count(&mut conn, "SELECT COUNT(*) AS n FROM photo_insights"), 0);
assert_eq!(
count(&mut conn, "SELECT COUNT(*) AS n FROM face_detections"),
0
);
assert_eq!(
count(&mut conn, "SELECT COUNT(*) AS n FROM tagged_photo"),
0
);
assert_eq!(
count(&mut conn, "SELECT COUNT(*) AS n FROM photo_insights"),
0
);
}
#[test]