From 8ef1bc370e8d08a3afaa2beec17c60a9cc5a867b Mon Sep 17 00:00:00 2001 From: hasezoey Date: Mon, 21 Sep 2026 23:21:23 +0200 Subject: [PATCH] fix(tui::ui::components::playlist::playlist_comp): fix accidental conditions being wrongly evaluated Previously it was A || B && C, which practically means A || (B && C), but it was meant (A || B) && C. --- tui/src/ui/components/playlist/playlist_comp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tui/src/ui/components/playlist/playlist_comp.rs b/tui/src/ui/components/playlist/playlist_comp.rs index b866b543..71f4f629 100644 --- a/tui/src/ui/components/playlist/playlist_comp.rs +++ b/tui/src/ui/components/playlist/playlist_comp.rs @@ -240,9 +240,9 @@ impl Component for Playlist { // Only try to adjust the cache capacity downwards if there is at least a MIN_DIFF_CACHE slot difference. // Always grow the cache size if the area is bigger! // Also never go below the MIN_CACHE_SIZE. - if area_as_usize.abs_diff(cache.capacity().get()) > MIN_DIFF_CACHE.get() - || area_as_usize > cache.capacity().get() - && area_as_usize > TrackCache::MIN_CACHE_SIZE.get() + if (area_as_usize.abs_diff(cache.capacity().get()) > MIN_DIFF_CACHE.get() + || area_as_usize > cache.capacity().get()) + && area_as_usize > TrackCache::MIN_CACHE_SIZE.get() { // This should never panic as "TrackCache::MIN_CACHE_SIZE" is a NonZeroUsize itself, so this branch can never happen if 0 let new_cap = NonZeroUsize::new(area_as_usize).expect("Expected MIN Check to not fail");