From e080c54258c52f88ed3127b3ded4abc7fea23f12 Mon Sep 17 00:00:00 2001 From: Togglebit Date: Fri, 27 Jun 2025 13:22:16 +0200 Subject: [PATCH] BUGFIX: control flow used wrong truthiness check --- anathema-store/src/slab/shared/arc.rs | 8 ++++---- anathema-widgets/src/nodes/controlflow.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/anathema-store/src/slab/shared/arc.rs b/anathema-store/src/slab/shared/arc.rs index 05de269b..f4f8ae23 100644 --- a/anathema-store/src/slab/shared/arc.rs +++ b/anathema-store/src/slab/shared/arc.rs @@ -55,10 +55,10 @@ impl Entry { // Try to make the entry vacant and return the value fn try_evict(&mut self, next_id: &mut Option) -> Option { // If the strong count is anything but 1, then return None - if let Entry::Occupied(value) = self { - if Arc::strong_count(value) != 1 { - return None; - } + if let Entry::Occupied(value) = self + && Arc::strong_count(value) != 1 + { + return None; } let mut value = Entry::Pending; diff --git a/anathema-widgets/src/nodes/controlflow.rs b/anathema-widgets/src/nodes/controlflow.rs index f4ac7245..d242132a 100644 --- a/anathema-widgets/src/nodes/controlflow.rs +++ b/anathema-widgets/src/nodes/controlflow.rs @@ -22,9 +22,9 @@ impl<'bp> ControlFlow<'bp> { Change::Changed | Change::Dropped => { let Some(el) = self.elses.get_mut(branch_id as usize) else { return }; let Some(cond) = el.cond.as_mut() else { return }; - let current = cond.as_bool(); + let current = cond.truthiness(); cond.reload(ctx.attribute_storage); - if cond.as_bool() != current { + if cond.truthiness() != current { ctx.truncate_children(&mut tree); } }