Use is_absent_and_set.

This commit is contained in:
Stephen Chung
2022-09-12 22:40:52 +08:00
parent 44219c732c
commit 08f6682d09
3 changed files with 17 additions and 8 deletions

View File

@@ -237,9 +237,8 @@ impl Engine {
func: f.clone(),
source: s.map(|s| Box::new(s.into())),
});
return if cache.filter.is_absent(hash) {
return if cache.filter.is_absent_and_set(hash) {
// Do not cache "one-hit wonders"
cache.filter.mark(hash);
*local_entry = new_entry;
local_entry.as_ref()
} else {
@@ -299,9 +298,8 @@ impl Engine {
}
});
return if cache.filter.is_absent(hash) {
return if cache.filter.is_absent_and_set(hash) {
// Do not cache "one-hit wonders"
cache.filter.mark(hash);
*local_entry = builtin;
local_entry.as_ref()
} else {