Code cleanup.

Converted rest of .clone() s on ref pointer to use the macro instead.
Stopped ignoring clippy clone_on_ref_pointer warnings since there shouldn't
be any, anymore.
This commit is contained in:
Jordan Petridis
2017-10-23 07:37:07 +03:00
parent 539a5eae2f
commit 9beea21a4f
8 changed files with 8 additions and 26 deletions
-4
View File
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use gtk;
use gtk::prelude::*;
@@ -60,8 +58,6 @@ pub fn get_headerbar(db: &Arc<Mutex<SqliteConnection>>, stack: &gtk::Stack) -> g
// and add a StackSwitcher when more views are added.
home_button.connect_clicked(clone!(stack => move |_| stack.set_visible_child_name("pd_grid")));
let stack = stack.clone();
let db = db.clone();
// FIXME: There appears to be a memmory leak here.
refresh_button.connect_clicked(clone!(stack, db => move |_| {
utils::refresh_db(&db, &stack);
-2
View File
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
extern crate gdk;
extern crate gdk_pixbuf;
extern crate gio;
+3 -5
View File
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use glib;
use gtk;
@@ -68,9 +66,9 @@ pub fn refresh_db(db: &Arc<Mutex<SqliteConnection>>, stack: &gtk::Stack) {
pub fn refresh_feed(db: &Arc<Mutex<SqliteConnection>>, stack: &gtk::Stack, source: &mut Source) {
let (sender, receiver) = channel();
GLOBAL.with(move |global| {
*global.borrow_mut() = Some((db.clone(), stack.clone(), receiver));
});
GLOBAL.with(clone!(db, stack => move |global| {
*global.borrow_mut() = Some((db, stack, receiver));
}));
let mut source = source.clone();
// TODO: add timeout option and error reporting.
+2 -7
View File
@@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use gtk;
use gtk::prelude::*;
@@ -116,12 +114,9 @@ pub fn populate_flowbox_no_store(
let pixbuf = get_pixbuf_from_path(img, title);
let f = create_flowbox_child(title, pixbuf.clone());
let db = db.clone();
let stack = stack.clone();
let parent = parent.clone();
f.connect_activate(move |_| {
f.connect_activate(clone!(db, stack, parent => move |_| {
on_flowbox_child_activate(&db, &stack, &parent, pixbuf.clone());
});
}));
flowbox.add(&f);
});
} else {
-2
View File
@@ -1,6 +1,4 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use open;
use diesel::prelude::SqliteConnection;
use hammond_data::dbqueries;