Get rid of clippy warnings

This commit is contained in:
Julian Hofer 2020-02-05 15:38:17 +01:00 committed by Jordan Petridis
parent e877da1825
commit 06a2c3ab12
10 changed files with 21 additions and 23 deletions

View File

@ -18,7 +18,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#![cfg_attr(feature = "cargo-clippy", allow(unit_arg))]
#![allow(clippy::unit_arg)]
//! Index Feeds.
use futures::future::*;

View File

@ -161,7 +161,6 @@ use crate::Feed;
pub fn get_feed(file_path: &str, id: i32) -> Feed {
use crate::feed::FeedBuilder;
use rss::Channel;
use std::fs;
use std::io::BufReader;
// open the xml file

View File

@ -153,7 +153,7 @@ fn get_ext(content: Option<&str>) -> Option<String> {
// TODO: Refactor... Somehow.
/// Handles the I/O of fetching a remote file and saving into a Buffer and A
/// File.
#[allow(needless_pass_by_value)]
#[allow(clippy::needless_pass_by_value)]
fn save_io(
file: &str,
resp: &mut reqwest::Response,

View File

@ -19,7 +19,7 @@
#![recursion_limit = "1024"]
#![allow(unknown_lints)]
#![cfg_attr(feature = "cargo-clippy", allow(blacklisted_name))]
#![allow(clippy::blacklisted_name)]
// Enable lint group collections
#![warn(nonstandard_style, edition_2018, rust_2018_idioms, bad_style, unused)]
// standalone lints

View File

@ -18,7 +18,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#![allow(new_without_default)]
#![allow(clippy::new_without_default)]
use glib::subclass;
use glib::subclass::prelude::*;

View File

@ -249,7 +249,7 @@ impl Header {
.connect_activate(clone!(weak, sender => move |_| {
weak.upgrade().map(|h| {
if h.add.add.get_sensitive() {
h.add.on_add_clicked(&sender);
h.add.on_add_clicked(&sender).unwrap();
}
});
}));

View File

@ -17,11 +17,12 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later
#![cfg_attr(
feature = "cargo-clippy",
allow(clone_on_ref_ptr, blacklisted_name, match_same_arms,)
#![allow(
clippy::clone_on_ref_ptr,
clippy::blacklisted_name,
clippy::match_same_arms,
unknown_lints
)]
#![allow(unknown_lints)]
// Enable lint group collections
#![warn(nonstandard_style, edition_2018, rust_2018_idioms, bad_style, unused)]
// standalone lints

View File

@ -17,7 +17,7 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later
#![cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
#![allow(clippy::type_complexity)]
use gdk_pixbuf::{Object, Pixbuf};
use glib::{self, object::WeakRef};
@ -115,7 +115,7 @@ pub(crate) fn lazy_load<T, C, F, W, U>(
/// This is a more flexible version of `lazy_load` with less constrains.
/// If you just want to lazy add `widgets` to a `container` check if
/// `lazy_load` fits your needs first.
#[cfg_attr(feature = "cargo-clippy", allow(redundant_closure))]
#[allow(clippy::redundant_closure)]
pub(crate) fn lazy_load_full<T, F, U>(data: T, mut func: F, finish_callback: U)
where
T: IntoIterator + 'static,
@ -137,7 +137,7 @@ where
// Kudos to Julian Sparber
// https://blogs.gnome.org/jsparber/2018/04/29/animate-a-scrolledwindow/
#[cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
#[allow(clippy::float_cmp)]
pub(crate) fn smooth_scroll_to(view: &gtk::ScrolledWindow, target: &gtk::Adjustment) {
if let Some(adj) = view.get_vadjustment() {
if let Some(clock) = view.get_frame_clock() {
@ -423,7 +423,7 @@ pub(crate) fn on_import_clicked(window: &gtk::ApplicationWindow, sender: &Sender
refresh(Some(sources), sender)
} else {
let text = i18n("Failed to parse the imported file");
sender.send(Action::ErrorNotification(text)).expect("Action channel blew up somehow");;
sender.send(Action::ErrorNotification(text)).expect("Action channel blew up somehow");
}
}))
} else {

View File

@ -522,7 +522,7 @@ fn on_play_bttn_clicked(
// Setup a callback that will update the progress bar.
#[inline]
#[cfg_attr(feature = "cargo-clippy", allow(if_same_then_else))]
#[allow(clippy::if_same_then_else)]
fn update_progressbar_callback(
widget: &Weak<EpisodeWidget>,
prog: &Arc<Mutex<manager::Progress>>,
@ -535,7 +535,7 @@ fn update_progressbar_callback(
timeout_add(100, callback);
}
#[allow(if_same_then_else)]
#[allow(clippy::if_same_then_else)]
fn progress_bar_helper(
widget: &Weak<EpisodeWidget>,
prog: &Arc<Mutex<manager::Progress>>,

View File

@ -23,7 +23,6 @@ use gtk;
use gtk::prelude::*;
use libhandy as hdy;
use libhandy::prelude::HeaderBarExt;
use libhandy::prelude::*;
use gio::{File, FileExt};
@ -244,14 +243,13 @@ impl PlayerRate {
fn connect_signals(&self, widget: &Rc<PlayerWidget>) {
let weak = Rc::downgrade(widget);
self.radio_normal
.connect_toggled(clone!(weak => move |rate| {
weak.upgrade().map(|w| w.on_rate_changed(1.00));
}));
self.radio125.connect_toggled(clone!(weak => move |rate| {
self.radio_normal.connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|w| w.on_rate_changed(1.00));
}));
self.radio125.connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|w| w.on_rate_changed(1.25));
}));
self.radio150.connect_toggled(clone!(weak => move |rate| {
self.radio150.connect_toggled(clone!(weak => move |_| {
weak.upgrade().map(|w| w.on_rate_changed(1.50));
}));
}