diff --git a/src/clients/networkmanager.rs b/src/clients/networkmanager.rs index 02ce6b5..f81ca45 100644 --- a/src/clients/networkmanager.rs +++ b/src/clients/networkmanager.rs @@ -140,7 +140,7 @@ pub async fn create_client() -> Result> { spawn(async move { if let Err(error) = client.run().await { error!("{}", error); - }; + } }); } Ok(client) diff --git a/src/clients/wayland/mod.rs b/src/clients/wayland/mod.rs index ca41926..299b087 100644 --- a/src/clients/wayland/mod.rs +++ b/src/clients/wayland/mod.rs @@ -157,7 +157,7 @@ impl Client { Event::Toplevel(event) => toplevel_tx.send_expect(event), #[cfg(feature = "clipboard")] Event::Clipboard(item) => clipboard_tx.send_expect(item), - }; + } } }); } diff --git a/src/config/layout.rs b/src/config/layout.rs index bc2601c..e9149a2 100644 --- a/src/config/layout.rs +++ b/src/config/layout.rs @@ -25,13 +25,11 @@ pub struct LayoutConfig { impl LayoutConfig { pub fn orientation(&self, info: &ModuleInfo) -> gtk::Orientation { self.orientation - .map(ModuleOrientation::into) - .unwrap_or(info.bar_position.orientation()) + .map_or(info.bar_position.orientation(), ModuleOrientation::into) } pub fn angle(&self, info: &ModuleInfo) -> f64 { self.orientation - .map(ModuleOrientation::to_angle) - .unwrap_or(info.bar_position.angle()) + .map_or(info.bar_position.angle(), ModuleOrientation::to_angle) } } diff --git a/src/ipc/server/ironvar.rs b/src/ipc/server/ironvar.rs index 4b82e7c..5058205 100644 --- a/src/ipc/server/ironvar.rs +++ b/src/ipc/server/ironvar.rs @@ -18,12 +18,11 @@ pub fn handle_command(command: IronvarCommand) -> Response { if key.contains('.') { for part in key.split('.') { - ns = match ns.get_namespace(part) { - Some(ns) => ns.clone(), - None => { - key = part.into(); - break; - } + ns = if let Some(ns) = ns.get_namespace(part) { + ns.clone() + } else { + key = part.into(); + break; }; } } diff --git a/src/ironvar.rs b/src/ironvar.rs index cb57023..cbe6922 100644 --- a/src/ironvar.rs +++ b/src/ironvar.rs @@ -80,7 +80,7 @@ impl Namespace for VariableManager { let namespaces = read_lock!(self.namespaces); let ns = namespaces.get(ns)?; - ns.get(key).map(|v| v.to_owned()) + ns.get(key).as_deref().map(ToOwned::to_owned) } else { read_lock!(self.variables).get(key).and_then(IronVar::get) } diff --git a/src/modules/launcher/mod.rs b/src/modules/launcher/mod.rs index 0cad0f5..3ab0b6f 100644 --- a/src/modules/launcher/mod.rs +++ b/src/modules/launcher/mod.rs @@ -466,11 +466,10 @@ impl Module for LauncherModule { &container, self.page_size, self.layout.orientation(info), - IconContext { - icon_back: &self.icons.page_back, - icon_fwd: &self.icons.page_forward, - icon_size: self.pagination_icon_size, - icon_theme: info.icon_theme, + &IconContext { + back: &self.icons.page_back, + fwd: &self.icons.page_forward, + size: self.pagination_icon_size, }, ); @@ -524,9 +523,9 @@ impl Module for LauncherModule { ); if self.reversed { - container.pack_end(button.button.deref(), false, false, 0); + container.pack_end(&*button.button, false, false, 0); } else { - container.add(button.button.deref()); + container.add(&*button.button); } if buttons.len() + 1 >= pagination.offset() + page_size { @@ -599,7 +598,7 @@ impl Module for LauncherModule { } } LauncherUpdate::Hover(_) => {} - }; + } }; rx.recv_glib(handle_event); diff --git a/src/modules/launcher/pagination.rs b/src/modules/launcher/pagination.rs index dc912b7..03e5157 100644 --- a/src/modules/launcher/pagination.rs +++ b/src/modules/launcher/pagination.rs @@ -14,10 +14,9 @@ pub struct Pagination { } pub struct IconContext<'a> { - pub icon_back: &'a str, - pub icon_fwd: &'a str, - pub icon_size: i32, - pub icon_theme: &'a IconTheme, + pub back: &'a str, + pub fwd: &'a str, + pub size: i32, } impl Pagination { @@ -86,8 +85,8 @@ impl Pagination { if page_size < *offset { *offset -= page_size; } else { - *offset = 1 - }; + *offset = 1; + } Self::update_page(&container, *offset, page_size); diff --git a/src/modules/notifications.rs b/src/modules/notifications.rs index 7d37cf4..9bc730b 100644 --- a/src/modules/notifications.rs +++ b/src/modules/notifications.rs @@ -156,7 +156,7 @@ impl Module for NotificationsModule { match initial_state { Ok(ev) => tx.send_update(ev).await, Err(err) => error!("{err:?}"), - }; + } while let Ok(ev) = rx.recv().await { tx.send_update(ev).await; diff --git a/src/modules/sysinfo/mod.rs b/src/modules/sysinfo/mod.rs index 02819b1..ea25bb6 100644 --- a/src/modules/sysinfo/mod.rs +++ b/src/modules/sysinfo/mod.rs @@ -251,7 +251,7 @@ impl Module for SysInfoModule { RefreshType::Disks => client.refresh_disks(), RefreshType::Network => client.refresh_network(), RefreshType::System => client.refresh_load_average(), - }; + } for (i, token_set) in format_tokens.iter().enumerate() { let is_affected = token_set diff --git a/src/modules/sysinfo/parser.rs b/src/modules/sysinfo/parser.rs index 6ae695b..6199ccf 100644 --- a/src/modules/sysinfo/parser.rs +++ b/src/modules/sysinfo/parser.rs @@ -237,7 +237,7 @@ fn parse_formatting(chars: &mut Peekable, mut formatting: Formatting) -> formatting.align = Alignment::try_from(char)?; } (_, FormattingMode::WidthFillAlign) => formatting.fill = char, - }; + } next_char = chars.next(); } diff --git a/src/popup.rs b/src/popup.rs index 097a18f..2caca60 100644 --- a/src/popup.rs +++ b/src/popup.rs @@ -35,7 +35,7 @@ impl Popup { /// This includes setting up gtk-layer-shell /// and an empty `gtk::Box` container. pub fn new( - ironbar: Rc, + ironbar: &Ironbar, module_info: &ModuleInfo, output_size: (i32, i32), gap: i32, diff --git a/src/script.rs b/src/script.rs index f1f6bff..01d2e76 100644 --- a/src/script.rs +++ b/src/script.rs @@ -217,7 +217,7 @@ impl Script { } Err(err) => error!("{err:?}"), }, - }; + } sleep(tokio::time::Duration::from_millis(self.interval)).await; } diff --git a/src/style.rs b/src/style.rs index 9dd4432..36ea671 100644 --- a/src/style.rs +++ b/src/style.rs @@ -35,7 +35,7 @@ pub fn load_css(style_path: PathBuf, application: Application) { .suggestion("Check the CSS file for errors") .suggestion("GTK CSS uses a subset of the full CSS spec and many properties are not available. Ensure you are not using any unsupported property.") ) - }; + } let screen = gdk::Screen::default().expect("Failed to get default GTK screen"); StyleContext::add_provider_for_screen(