Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaust committed Jan 8, 2025
1 parent c1e68d3 commit f0647c7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
9 changes: 5 additions & 4 deletions src/items/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ impl CheckMenuItem {
label: super::strip_mnemonic(item.text()),
enabled: item.is_enabled(),
checked: item.is_checked(),
}.into()
}
.into()
}

/// Create a new check menu item.
Expand Down Expand Up @@ -133,7 +134,7 @@ impl CheckMenuItem {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand All @@ -150,7 +151,7 @@ impl CheckMenuItem {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand All @@ -172,7 +173,7 @@ impl CheckMenuItem {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand Down
6 changes: 3 additions & 3 deletions src/items/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl IconMenuItem {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand All @@ -225,7 +225,7 @@ impl IconMenuItem {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand All @@ -247,7 +247,7 @@ impl IconMenuItem {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand Down
4 changes: 1 addition & 3 deletions src/items/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use std::sync::Arc;
#[cfg(all(feature = "ksni", target_os = "linux"))]
use arc_swap::ArcSwap;

use crate::{
accelerator::Accelerator, sealed::IsMenuItemBase, IsMenuItem, MenuId, MenuItemKind,
};
use crate::{accelerator::Accelerator, sealed::IsMenuItemBase, IsMenuItem, MenuId, MenuItemKind};

/// A menu item inside a [`Menu`] or [`Submenu`] and contains only text.
///
Expand Down
2 changes: 1 addition & 1 deletion src/items/predefined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl PredefinedMenuItem {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand Down
16 changes: 8 additions & 8 deletions src/items/submenu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Submenu {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();

Expand All @@ -150,7 +150,7 @@ impl Submenu {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();

Expand All @@ -171,7 +171,7 @@ impl Submenu {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();

Expand All @@ -194,7 +194,7 @@ impl Submenu {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();

Expand Down Expand Up @@ -232,7 +232,7 @@ impl Submenu {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand All @@ -249,7 +249,7 @@ impl Submenu {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand All @@ -265,7 +265,7 @@ impl Submenu {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand All @@ -283,7 +283,7 @@ impl Submenu {

#[cfg(all(feature = "ksni", target_os = "linux"))]
self.compat.store(Arc::new(Self::compat_menu_item(&inner)));

#[cfg(all(feature = "ksni", target_os = "linux"))]
crate::send_menu_update();
}
Expand Down
12 changes: 6 additions & 6 deletions src/platform_impl/gtk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ impl Menu {
/// Returns a list of menu items that has been added to this menu.
#[cfg(feature = "ksni")]
pub fn compat_items(&self) -> Vec<Arc<ArcSwap<crate::CompatMenuItem>>> {
self.children.iter().map(MenuItemKind::compat_child).collect()
self.children
.iter()
.map(MenuItemKind::compat_child)
.collect()
}

pub fn init_for_gtk_window<W, C>(
Expand Down Expand Up @@ -917,7 +920,7 @@ impl MenuChild {

let child = child.inner();
let child_ = child.borrow();

// remove all the gtk items that are related to this gtk menu and destroy it
if let Some(items) = child_.gtk_menu_items.borrow_mut().remove(menu_id) {
for item in items {
Expand Down Expand Up @@ -958,10 +961,7 @@ impl MenuChild {
}

pub fn items(&self) -> Vec<MenuItemKind> {
self.children
.as_ref()
.unwrap()
.to_vec()
self.children.as_ref().unwrap().to_vec()
}

#[cfg(feature = "ksni")]
Expand Down

0 comments on commit f0647c7

Please sign in to comment.