diff --git a/local/recipes/system/redbear-power/source/src/affinity.rs b/local/recipes/system/redbear-power/source/src/affinity.rs index 5e3386094e..654af8d692 100644 --- a/local/recipes/system/redbear-power/source/src/affinity.rs +++ b/local/recipes/system/redbear-power/source/src/affinity.rs @@ -114,10 +114,10 @@ impl AffinityEditor { } pub fn should_auto_close(&self) -> bool { - if let Some(at) = self.result_at { - if self.result.as_ref().map_or(false, |r| r.is_ok()) { - return at.elapsed().as_secs() >= 2; - } + if let Some(at) = self.result_at + && self.result.as_ref().is_some_and(|r| r.is_ok()) + { + return at.elapsed().as_secs() >= 2; } false } @@ -127,7 +127,7 @@ impl Widget for &mut AffinityEditor { fn render(self, area: Rect, buf: &mut ratatui::buffer::Buffer) { Clear.render(area, buf); let cols = self.grid_cols(); - let rows = (self.num_cpus + cols - 1) / cols; + let rows = self.num_cpus.div_ceil(cols); let dialog_h = (rows + 7).min(24) as u16; let dialog_w = ((cols * 6) + 4).min(80) as u16; let dx = area.x + (area.width.saturating_sub(dialog_w)) / 2;