Skip to content

Commit

Permalink
refactor: fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeStanger committed Apr 1, 2024
1 parent 10b3b01 commit 1b35354
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl Ironbar {
while let Ok(event) = rx_outputs.recv().await {
match event.event_type {
OutputEventType::New => {
match load_output_bars(&instance, &app, event.output) {
match load_output_bars(&instance, &app, &event.output) {
Ok(mut new_bars) => {
instance.bars.borrow_mut().append(&mut new_bars);
}
Expand Down Expand Up @@ -316,7 +316,7 @@ fn get_display() -> Display {
fn load_output_bars(
ironbar: &Rc<Ironbar>,
app: &Application,
output: OutputInfo,
output: &OutputInfo,
) -> Result<Vec<Bar>> {
let Some(monitor_name) = &output.name else {
return Err(Report::msg("Output missing monitor name"));
Expand Down
2 changes: 1 addition & 1 deletion src/modules/custom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl Module<gtk::Box> for CustomModule {
context.button_id = popup_buttons
.borrow()
.first()
.map_or(usize::MAX, |button| button.popup_id());
.map_or(usize::MAX, PopupButton::popup_id);

let popup = self
.into_popup(
Expand Down
4 changes: 2 additions & 2 deletions src/modules/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn default_icon_open_dnd() -> String {
}

impl Icons {
fn icon(&self, value: &swaync::Event) -> &str {
fn icon(&self, value: swaync::Event) -> &str {
match (value.cc_open, value.count > 0, value.dnd) {
(true, _, true) => &self.open_dnd,
(true, true, false) => &self.open_some,
Expand Down Expand Up @@ -172,7 +172,7 @@ impl Module<Overlay> for NotificationsModule {
let button = button.clone();

glib_recv!(context.subscribe(), ev => {
let icon = self.icons.icon(&ev);
let icon = self.icons.icon(ev);
button.set_label(icon);

label.set_label(&ev.count.to_string());
Expand Down
15 changes: 7 additions & 8 deletions src/modules/tray/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Module<MenuBar> for TrayModule {

// listen to tray updates
spawn(async move {
for (key, (item, menu)) in initial_items.into_iter() {
for (key, (item, menu)) in initial_items {
send_async!(
tx,
ModuleUpdateEvent::Update(Event::Add(key.clone(), item.into()))
Expand All @@ -89,7 +89,7 @@ impl Module<MenuBar> for TrayModule {
}

while let Ok(message) = tray_rx.recv().await {
send_async!(tx, ModuleUpdateEvent::Update(message))
send_async!(tx, ModuleUpdateEvent::Update(message));
}
});

Expand Down Expand Up @@ -159,12 +159,11 @@ fn on_update(
let mut menu_item = TrayMenu::new(tx.clone(), address.clone(), *item);
container.add(&menu_item.widget);

match icon::get_image(&menu_item, icon_theme, icon_size, prefer_icons) {
Ok(image) => menu_item.set_image(&image),
Err(_) => {
let label = menu_item.title.clone().unwrap_or(address.clone());
menu_item.set_label(&label)
}
if let Ok(image) = icon::get_image(&menu_item, icon_theme, icon_size, prefer_icons) {
menu_item.set_image(&image);
} else {
let label = menu_item.title.clone().unwrap_or(address.clone());
menu_item.set_label(&label);
};

menu_item.widget.show();
Expand Down

0 comments on commit 1b35354

Please sign in to comment.