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
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
8 changed files with 8 additions and 26 deletions

View File

@ -3,7 +3,7 @@
before_script: before_script:
- apt-get update -yqq - apt-get update -yqq
- apt-get install -yqq --no-install-recommends build-essential - apt-get install -yqq --no-install-recommends build-essential
- apt-get install -yqq libgtk-3-dev - apt-get install -yqq --no-install-recommends libgtk-3-dev
# kcov # kcov
# - apt-get install -y libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev # - apt-get install -y libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev
@ -39,7 +39,7 @@ test:rustfmt:
before_script: before_script:
- apt-get update -yqq - apt-get update -yqq
- apt-get install -yqq --no-install-recommends build-essential - apt-get install -yqq --no-install-recommends build-essential
- apt-get install -yqq libgtk-3-dev - apt-get install -yqq --no-install-recommends build-essential libgtk-3-dev
- export PATH="$PATH:$HOME/.cargo/bin" - export PATH="$PATH:$HOME/.cargo/bin"
- which rustfmt || cargo install rustfmt-nightly - which rustfmt || cargo install rustfmt-nightly
script: script:
@ -47,6 +47,7 @@ test:rustfmt:
- cargo fmt --all -- --write-mode=diff - cargo fmt --all -- --write-mode=diff
# Configure and run clippy on nightly # Configure and run clippy on nightly
# Only fails on errors atm.
test:clippy: test:clippy:
image: "rustlang/rust:nightly" image: "rustlang/rust:nightly"
before_script: before_script:
@ -58,4 +59,3 @@ test:clippy:
script: script:
- rustc --version && cargo --version - rustc --version && cargo --version
- cargo clippy --all - cargo clippy --all
allow_failure: true

View File

@ -1,5 +1,4 @@
#![allow(dead_code)] #![allow(dead_code)]
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use diesel::prelude::*; use diesel::prelude::*;
use diesel; use diesel;

View File

@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use reqwest; use reqwest;
use hyper::header::*; use hyper::header::*;
use diesel::prelude::*; use diesel::prelude::*;

View File

@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use gtk; use gtk;
use gtk::prelude::*; 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. // and add a StackSwitcher when more views are added.
home_button.connect_clicked(clone!(stack => move |_| stack.set_visible_child_name("pd_grid"))); 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. // FIXME: There appears to be a memmory leak here.
refresh_button.connect_clicked(clone!(stack, db => move |_| { refresh_button.connect_clicked(clone!(stack, db => move |_| {
utils::refresh_db(&db, &stack); utils::refresh_db(&db, &stack);

View File

@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
extern crate gdk; extern crate gdk;
extern crate gdk_pixbuf; extern crate gdk_pixbuf;
extern crate gio; extern crate gio;

View File

@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use glib; use glib;
use gtk; 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) { pub fn refresh_feed(db: &Arc<Mutex<SqliteConnection>>, stack: &gtk::Stack, source: &mut Source) {
let (sender, receiver) = channel(); let (sender, receiver) = channel();
GLOBAL.with(move |global| { GLOBAL.with(clone!(db, stack => move |global| {
*global.borrow_mut() = Some((db.clone(), stack.clone(), receiver)); *global.borrow_mut() = Some((db, stack, receiver));
}); }));
let mut source = source.clone(); let mut source = source.clone();
// TODO: add timeout option and error reporting. // TODO: add timeout option and error reporting.

View File

@ -1,5 +1,3 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use gtk; use gtk;
use gtk::prelude::*; use gtk::prelude::*;
@ -116,12 +114,9 @@ pub fn populate_flowbox_no_store(
let pixbuf = get_pixbuf_from_path(img, title); let pixbuf = get_pixbuf_from_path(img, title);
let f = create_flowbox_child(title, pixbuf.clone()); let f = create_flowbox_child(title, pixbuf.clone());
let db = db.clone(); f.connect_activate(clone!(db, stack, parent => move |_| {
let stack = stack.clone();
let parent = parent.clone();
f.connect_activate(move |_| {
on_flowbox_child_activate(&db, &stack, &parent, pixbuf.clone()); on_flowbox_child_activate(&db, &stack, &parent, pixbuf.clone());
}); }));
flowbox.add(&f); flowbox.add(&f);
}); });
} else { } else {

View File

@ -1,6 +1,4 @@
#![cfg_attr(feature = "cargo-clippy", allow(clone_on_ref_ptr))]
use open; use open;
use diesel::prelude::SqliteConnection; use diesel::prelude::SqliteConnection;
use hammond_data::dbqueries; use hammond_data::dbqueries;