Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix clippy clone assignment #191

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading