Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

PERF-CATALOG: smart_album_holds stops storing an answer nothing can read

Nathaniel Ledford587529956bad
diff --git a/crates/catalog/src/rules.rs b/crates/catalog/src/rules.rs
index ec92dc724..6514cf783 100644
--- a/crates/catalog/src/rules.rs
+++ b/crates/catalog/src/rules.rs
@@ -514,9 +514,11 @@ pub(crate) fn smart_album_holds(id: crate::AlbumId, photo: crate::PhotoId, match
}
}
}
- let _forget = Forget(EVALUATING.with_borrow(Vec::is_empty));
+ let outermost = EVALUATING.with_borrow(Vec::is_empty);
+ let _forget = Forget(outermost);
let answer = evaluating(id, matches);
- if let Some(a) = answer {
+ // (the outermost answer would be forgotten as this returns: only what a nested question worked out is kept)
+ if let (Some(a), false) = (answer, outermost) {
ANSWERS.with_borrow_mut(|known| known.insert((id, photo), a));
}
answer.unwrap_or(false)