Skip to content

Commit

Permalink
refactor: fix clippy clone assignment (#191)
Browse files Browse the repository at this point in the history
* refactor: fix clippy

* remove dbg

---------

Co-authored-by: Amr Bashir <[email protected]>
  • Loading branch information
pewsheen and amrbashir authored May 7, 2024
1 parent a2aadde commit 67c9d6c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/platform_impl/gtk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use accelerator::{from_gtk_mnemonic, parse_accelerator, to_gtk_mnemonic};
use gtk::{gdk, prelude::*, AboutDialog, Container, Orientation};
use std::{
cell::RefCell,
collections::HashMap,
collections::{hash_map::Entry, HashMap},
rc::Rc,
sync::atomic::{AtomicBool, Ordering},
};
Expand Down Expand Up @@ -264,9 +264,9 @@ 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 let Entry::Vacant(e) = self.gtk_menubars.entry(id) {
let menu_bar = gtk::MenuBar::new();
self.gtk_menubars.insert(id, menu_bar);
e.insert(menu_bar);
} else {
return Err(crate::Error::AlreadyInitialized);
}
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 67c9d6c

Please sign in to comment.