Skip to content

Commit

Permalink
refactor: fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
pewsheen committed May 7, 2024
1 parent a2aadde commit 1e0c97f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/platform_impl/gtk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl Menu {

// This is the first time this method has been called on this window
// so we need to create the menubar and its parent box
if self.gtk_menubars.get(&id).is_none() {
if !self.gtk_menubars.contains_key(&id) {
let menu_bar = gtk::MenuBar::new();
self.gtk_menubars.insert(id, menu_bar);
} else {
Expand Down Expand Up @@ -759,7 +759,7 @@ impl MenuChild {
/// IconMenuItem methods
impl MenuChild {
pub fn set_icon(&mut self, icon: Option<Icon>) {
self.icon = icon.clone();
self.icon.clone_from(&icon);

let pixbuf = icon.map(|i| i.inner.to_pixbuf_scale(16, 16));
for items in self.gtk_menu_items.borrow().values() {
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ impl MenuChild {
/// IconMenuItem methods
impl MenuChild {
pub fn set_icon(&mut self, icon: Option<Icon>) {
self.icon = icon.clone();
self.icon.clone_from(&icon);
self.native_icon = None;
for ns_items in self.ns_menu_items.values() {
for ns_item in ns_items {
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ impl MenuChild {
/// IconMenuItem methods
impl MenuChild {
pub fn set_icon(&mut self, icon: Option<Icon>) {
self.icon = icon.clone();
self.icon.clone_from(&icon);

let hbitmap = icon.map(|i| unsafe { i.inner.to_hbitmap() }).unwrap_or(0);
let info = create_icon_item_info(hbitmap);
Expand Down

0 comments on commit 1e0c97f

Please sign in to comment.