tony / oxwm

drop `Result` from `bar::update_blocks` and convert `bar::draw` to use the `X11Error` type Browse files
update_blocks no longer returns a Result since it can't fail
emzywastaken committed 2025-10-14 parent ed85f11 commit 34487bf67f3b006968a5b464134bca4d1fb6ffbc
Showing 2 changed files with 4 additions and 7 deletions. UnifiedSplit
+3 −4 src/bar/bar.rs
@@ -1,6 +1,7 @@
1 1 use super::blocks::Block;
2 2 use super::font::{Font, FontDraw};
3 3 use crate::Config;
4 +use crate::window_manager::X11Error;
4 5 use anyhow::Result;
5 6 use std::time::Instant;
6 7 use x11rb::COPY_DEPTH_FROM_PARENT;
@@ -148,7 +149,7 @@ impl Bar {
148 149 self.needs_redraw = true;
149 150 }
150 151
151 - pub fn update_blocks(&mut self) -> Result<()> {
152 + pub fn update_blocks(&mut self) {
152 153 let now = Instant::now();
153 154 let mut changed = false;
154 155
@@ -173,8 +174,6 @@ impl Bar {
173 174 self.status_text = parts.join("");
174 175 self.needs_redraw = true;
175 176 }
176 -
177 - Ok(())
178 177 }
179 178
180 179 pub fn draw(
@@ -182,7 +181,7 @@ impl Bar {
182 181 connection: &RustConnection,
183 182 current_tags: u32,
184 183 occupied_tags: u32,
185 - ) -> Result<()> {
184 + ) -> std::result::Result<(), X11Error> {
186 185 if !self.needs_redraw {
187 186 return Ok(());
188 187 }
+1 −3 src/window_manager.rs
@@ -378,8 +378,7 @@ impl WindowManager {
378 378 self.update_bar()?;
379 379
380 380 loop {
381 - // TODO: Identify errors
382 - self.bar.update_blocks()?;
381 + self.bar.update_blocks();
383 382
384 383 if let Ok(Some(event)) = self.connection.poll_for_event() {
385 384 if let Some(should_restart) = self.handle_event(event)? {
@@ -436,7 +435,6 @@ impl WindowManager {
436 435 }
437 436
438 437 self.bar.invalidate();
439 - // TODO: Identify errors
440 438 self.bar
441 439 .draw(&self.connection, self.selected_tags, occupied_tags)?;
442 440 Ok(())