Cargo fmt

This commit is contained in:
Jordan Petridis 2018-04-13 04:35:50 +03:00
parent f94ccb9947
commit 87421ce74d
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
25 changed files with 80 additions and 77 deletions

View File

@ -16,10 +16,10 @@ extern crate rss;
// use futures::future::*; // use futures::future::*;
use tokio_core::reactor::Core; use tokio_core::reactor::Core;
use hammond_data::FeedBuilder;
use hammond_data::Source;
use hammond_data::database::truncate_db; use hammond_data::database::truncate_db;
use hammond_data::pipeline; use hammond_data::pipeline;
use hammond_data::FeedBuilder;
use hammond_data::Source;
// use hammond_data::errors::*; // use hammond_data::errors::*;
use std::io::BufReader; use std::io::BufReader;

View File

@ -117,10 +117,10 @@ mod tests {
use rss::Channel; use rss::Channel;
use tokio_core::reactor::Core; use tokio_core::reactor::Core;
use Source;
use database::truncate_db; use database::truncate_db;
use dbqueries; use dbqueries;
use utils::get_feed; use utils::get_feed;
use Source;
use std::fs; use std::fs;
use std::io::BufReader; use std::io::BufReader;

View File

@ -1,18 +1,22 @@
#![recursion_limit = "1024"] #![recursion_limit = "1024"]
#![cfg_attr(all(test, feature = "clippy"), allow(option_unwrap_used, result_unwrap_used))] #![cfg_attr(all(test, feature = "clippy"), allow(option_unwrap_used, result_unwrap_used))]
#![cfg_attr(feature = "cargo-clippy", allow(blacklisted_name))] #![cfg_attr(feature = "cargo-clippy", allow(blacklisted_name))]
#![cfg_attr(feature = "clippy", #![cfg_attr(
warn(option_unwrap_used, result_unwrap_used, print_stdout, feature = "clippy",
wrong_pub_self_convention, mut_mut, non_ascii_literal, similar_names, warn(
unicode_not_nfc, enum_glob_use, if_not_else, items_after_statements, option_unwrap_used, result_unwrap_used, print_stdout, wrong_pub_self_convention, mut_mut,
used_underscore_binding))] non_ascii_literal, similar_names, unicode_not_nfc, enum_glob_use, if_not_else,
items_after_statements, used_underscore_binding
)
)]
#![allow(unknown_lints)] #![allow(unknown_lints)]
#![deny(bad_style, const_err, dead_code, improper_ctypes, legacy_directory_ownership, #![deny(
non_shorthand_field_patterns, no_mangle_generic_items, overflowing_literals, bad_style, const_err, dead_code, improper_ctypes, legacy_directory_ownership,
path_statements, patterns_in_fns_without_body, plugin_as_library, private_in_public, non_shorthand_field_patterns, no_mangle_generic_items, overflowing_literals, path_statements,
private_no_mangle_fns, private_no_mangle_statics, safe_extern_statics, patterns_in_fns_without_body, plugin_as_library, private_in_public, private_no_mangle_fns,
unconditional_recursion, unions_with_drop_fields, unused_allocation, unused_comparisons, private_no_mangle_statics, safe_extern_statics, unconditional_recursion,
unused_parens, while_true)] unions_with_drop_fields, unused_allocation, unused_comparisons, unused_parens, while_true
)]
#![deny(missing_debug_implementations, missing_docs, trivial_casts, trivial_numeric_casts)] #![deny(missing_debug_implementations, missing_docs, trivial_casts, trivial_numeric_casts)]
#![deny(unused_extern_crates, unused)] #![deny(unused_extern_crates, unused)]
@ -54,21 +58,21 @@ extern crate tokio_core;
extern crate url; extern crate url;
extern crate xdg; extern crate xdg;
pub mod database;
#[allow(missing_docs)] #[allow(missing_docs)]
pub mod dbqueries; pub mod dbqueries;
#[allow(missing_docs)] #[allow(missing_docs)]
pub mod errors; pub mod errors;
pub mod utils;
pub mod database;
pub mod pipeline;
pub(crate) mod models;
mod feed; mod feed;
pub(crate) mod models;
mod parser; mod parser;
pub mod pipeline;
mod schema; mod schema;
pub mod utils;
pub use feed::{Feed, FeedBuilder}; pub use feed::{Feed, FeedBuilder};
pub use models::{Episode, EpisodeWidgetQuery, Podcast, PodcastCoverQuery, Source};
pub use models::Save; pub use models::Save;
pub use models::{Episode, EpisodeWidgetQuery, Podcast, PodcastCoverQuery, Source};
/// [XDG Base Direcotory](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) Paths. /// [XDG Base Direcotory](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) Paths.
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]

View File

@ -1,7 +1,7 @@
use chrono::prelude::*; use chrono::prelude::*;
use diesel; use diesel;
use diesel::SaveChangesDsl;
use diesel::prelude::*; use diesel::prelude::*;
use diesel::SaveChangesDsl;
use database::connection; use database::connection;
use errors::DataError; use errors::DataError;

View File

@ -287,8 +287,8 @@ impl NewEpisodeMinimal {
mod tests { mod tests {
use database::truncate_db; use database::truncate_db;
use dbqueries; use dbqueries;
use models::*;
use models::new_episode::{NewEpisodeMinimal, NewEpisodeMinimalBuilder}; use models::new_episode::{NewEpisodeMinimal, NewEpisodeMinimalBuilder};
use models::*;
use rss::Channel; use rss::Channel;

View File

@ -4,8 +4,8 @@ use diesel::prelude::*;
use rss; use rss;
use errors::DataError; use errors::DataError;
use models::{Index, Insert, Update};
use models::Podcast; use models::Podcast;
use models::{Index, Insert, Update};
use schema::podcast; use schema::podcast;
use database::connection; use database::connection;

View File

@ -3,10 +3,10 @@ use diesel::SaveChangesDsl;
use rss::Channel; use rss::Channel;
use url::Url; use url::Url;
use hyper::{Client, Method, Request, Response, StatusCode, Uri};
use hyper::client::HttpConnector; use hyper::client::HttpConnector;
use hyper::header::{ETag, EntityTag, HttpDate, IfModifiedSince, IfNoneMatch, LastModified, use hyper::header::{ETag, EntityTag, HttpDate, IfModifiedSince, IfNoneMatch, LastModified,
Location, UserAgent}; Location, UserAgent};
use hyper::{Client, Method, Request, Response, StatusCode, Uri};
use hyper_tls::HttpsConnector; use hyper_tls::HttpsConnector;
// use futures::future::ok; // use futures::future::ok;
@ -213,9 +213,11 @@ impl Source {
if !ignore_etags { if !ignore_etags {
if let Some(foo) = self.http_etag() { if let Some(foo) = self.http_etag() {
req.headers_mut().set(IfNoneMatch::Items(vec![ req.headers_mut()
EntityTag::new(true, foo.to_owned()), .set(IfNoneMatch::Items(vec![EntityTag::new(
])); true,
foo.to_owned(),
)]));
} }
if let Some(foo) = self.last_modified() { if let Some(foo) = self.last_modified() {

View File

@ -4,18 +4,18 @@
use futures::future::*; use futures::future::*;
// use futures::prelude::*; // use futures::prelude::*;
use hyper::Client;
use hyper::client::HttpConnector; use hyper::client::HttpConnector;
use hyper::Client;
use hyper_tls::HttpsConnector; use hyper_tls::HttpsConnector;
use tokio_core::reactor::Core; use tokio_core::reactor::Core;
use num_cpus; use num_cpus;
use rss; use rss;
use Source;
use dbqueries; use dbqueries;
use errors::DataError; use errors::DataError;
use models::{IndexState, NewEpisode, NewEpisodeMinimal}; use models::{IndexState, NewEpisode, NewEpisodeMinimal};
use Source;
// use std::sync::{Arc, Mutex}; // use std::sync::{Arc, Mutex};
@ -141,8 +141,8 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use Source;
use database::truncate_db; use database::truncate_db;
use Source;
// (path, url) tuples. // (path, url) tuples.
const URLS: &[(&str, &str)] = { const URLS: &[(&str, &str)] = {

View File

@ -11,8 +11,8 @@ use std::io::{BufWriter, Read, Write};
use std::path::Path; use std::path::Path;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use hammond_data::{EpisodeWidgetQuery, PodcastCoverQuery, Save};
use hammond_data::xdg_dirs::HAMMOND_CACHE; use hammond_data::xdg_dirs::HAMMOND_CACHE;
use hammond_data::{EpisodeWidgetQuery, PodcastCoverQuery, Save};
// use failure::Error; // use failure::Error;
use errors::DownloadError; use errors::DownloadError;
@ -234,9 +234,9 @@ pub fn cache_image(pd: &PodcastCoverQuery) -> Result<String, DownloadError> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use hammond_data::Source;
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::pipeline; use hammond_data::pipeline;
use hammond_data::Source;
use std::fs; use std::fs;

View File

@ -3,14 +3,14 @@
use gio::{ApplicationExt, ApplicationExtManual, ApplicationFlags, Settings, SettingsExt}; use gio::{ApplicationExt, ApplicationExtManual, ApplicationFlags, Settings, SettingsExt};
use glib; use glib;
use gtk; use gtk;
use gtk::SettingsExt as GtkSettingsExt;
use gtk::prelude::*; use gtk::prelude::*;
use gtk::SettingsExt as GtkSettingsExt;
use failure::Error; use failure::Error;
use rayon; use rayon;
use hammond_data::{Podcast, Source};
use hammond_data::utils::delete_show; use hammond_data::utils::delete_show;
use hammond_data::{Podcast, Source};
use appnotif::*; use appnotif::*;
use headerbar::Header; use headerbar::Header;
@ -19,8 +19,8 @@ use stacks::Content;
use utils; use utils;
use widgets::mark_all_watched; use widgets::mark_all_watched;
use std::sync::Arc;
use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]

View File

@ -32,11 +32,7 @@ impl Default for InAppNotification {
} }
impl InAppNotification { impl InAppNotification {
pub fn new<F, U>( pub fn new<F, U>(text: String, mut callback: F, undo_callback: U) -> Self
text: String,
mut callback: F,
undo_callback: U,
) -> Self
where where
F: FnMut() -> glib::Continue + 'static, F: FnMut() -> glib::Continue + 'static,
U: Fn() + 'static, U: Fn() + 'static,

View File

@ -5,8 +5,8 @@ use failure::Error;
use failure::ResultExt; use failure::ResultExt;
use url::Url; use url::Url;
use hammond_data::Source;
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::Source;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;

View File

@ -1,6 +1,9 @@
#![cfg_attr(feature = "cargo-clippy", #![cfg_attr(
allow(clone_on_ref_ptr, needless_pass_by_value, useless_format, blacklisted_name, feature = "cargo-clippy",
match_same_arms))] allow(
clone_on_ref_ptr, needless_pass_by_value, useless_format, blacklisted_name, match_same_arms
)
)]
#![allow(unknown_lints)] #![allow(unknown_lints)]
#![deny(unused_extern_crates, unused)] #![deny(unused_extern_crates, unused)]
@ -64,18 +67,18 @@ macro_rules! clone {
// They do not need to be public // They do not need to be public
// But it helps when looking at the generated docs. // But it helps when looking at the generated docs.
pub mod stacks;
pub mod views; pub mod views;
pub mod widgets; pub mod widgets;
pub mod stacks;
pub mod headerbar;
pub mod app; pub mod app;
pub mod headerbar;
pub mod settings;
pub mod utils;
pub mod manager;
pub mod static_resource;
pub mod appnotif; pub mod appnotif;
pub mod manager;
pub mod settings;
pub mod static_resource;
pub mod utils;
use app::App; use app::App;

View File

@ -8,8 +8,8 @@ use hammond_downloader::downloader::{get_episode, DownloadProgress};
use app::Action; use app::Action;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::{Arc, Mutex, RwLock};
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex, RwLock};
// use std::sync::atomic::AtomicUsize; // use std::sync::atomic::AtomicUsize;
// use std::path::PathBuf; // use std::path::PathBuf;
@ -122,17 +122,17 @@ pub fn add(id: i32, directory: String, sender: Sender<Action>) -> Result<(), Err
mod tests { mod tests {
use super::*; use super::*;
use hammond_data::{Episode, Source};
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::pipeline; use hammond_data::pipeline;
use hammond_data::utils::get_download_folder; use hammond_data::utils::get_download_folder;
use hammond_data::{Episode, Source};
use hammond_downloader::downloader::get_episode; use hammond_downloader::downloader::get_episode;
use std::{thread, time};
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
use std::{thread, time};
#[test] #[test]
// This test inserts an rss feed to your `XDG_DATA/hammond/hammond.db` so we make it explicit // This test inserts an rss feed to your `XDG_DATA/hammond/hammond.db` so we make it explicit

View File

@ -7,8 +7,8 @@ use app::Action;
use stacks::EpisodeStack; use stacks::EpisodeStack;
use stacks::ShowStack; use stacks::ShowStack;
use std::sync::Arc;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::sync::Arc;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Content { pub struct Content {

View File

@ -1,6 +1,6 @@
use gtk; use gtk;
use gtk::Cast;
use gtk::prelude::*; use gtk::prelude::*;
use gtk::Cast;
use failure::Error; use failure::Error;

View File

@ -1,19 +1,19 @@
use gtk; use gtk;
use gtk::Cast;
use gtk::prelude::*; use gtk::prelude::*;
use gtk::Cast;
use failure::Error; use failure::Error;
use hammond_data::Podcast;
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::Podcast;
use views::{EmptyView, ShowsPopulated}; use views::{EmptyView, ShowsPopulated};
use app::Action; use app::Action;
use widgets::ShowWidget; use widgets::ShowWidget;
use std::sync::Arc;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::sync::Arc;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ShowStack { pub struct ShowStack {

View File

@ -4,8 +4,8 @@ use gdk_pixbuf::Pixbuf;
use gio::{Settings, SettingsExt}; use gio::{Settings, SettingsExt};
use glib; use glib;
use gtk; use gtk;
use gtk::{IsA, Widget};
use gtk::prelude::*; use gtk::prelude::*;
use gtk::{IsA, Widget};
use failure::Error; use failure::Error;
use rayon; use rayon;
@ -15,21 +15,21 @@ use send_cell::SendCell;
use serde_json::Value; use serde_json::Value;
// use hammond_data::feed; // use hammond_data::feed;
use hammond_data::{PodcastCoverQuery, Source};
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::pipeline; use hammond_data::pipeline;
use hammond_data::utils::checkup; use hammond_data::utils::checkup;
use hammond_data::{PodcastCoverQuery, Source};
use hammond_downloader::downloader; use hammond_downloader::downloader;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::sync::{Mutex, RwLock};
use std::sync::Arc;
use std::sync::mpsc::*; use std::sync::mpsc::*;
use std::sync::Arc;
use std::sync::{Mutex, RwLock};
use app::Action; use app::Action;
use chrono::Duration;
use chrono::prelude::*; use chrono::prelude::*;
use chrono::Duration;
/// Lazy evaluates and loads widgets to the parent `container` widget. /// Lazy evaluates and loads widgets to the parent `container` widget.
/// ///

View File

@ -3,15 +3,15 @@ use failure::Error;
use gtk; use gtk;
use gtk::prelude::*; use gtk::prelude::*;
use hammond_data::EpisodeWidgetQuery;
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::EpisodeWidgetQuery;
use app::Action; use app::Action;
use utils::{get_ignored_shows, set_image_from_path}; use utils::{get_ignored_shows, set_image_from_path};
use widgets::EpisodeWidget; use widgets::EpisodeWidget;
use std::sync::Arc;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::sync::Arc;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum ListSplit { enum ListSplit {

View File

@ -1,6 +1,6 @@
mod shows;
mod episodes;
mod empty; mod empty;
mod episodes;
mod shows;
pub use self::empty::EmptyView; pub use self::empty::EmptyView;
pub use self::episodes::EpisodesView; pub use self::episodes::EpisodesView;

View File

@ -2,14 +2,14 @@ use failure::Error;
use gtk; use gtk;
use gtk::prelude::*; use gtk::prelude::*;
use hammond_data::{Podcast, PodcastCoverQuery};
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::{Podcast, PodcastCoverQuery};
use app::Action; use app::Action;
use utils::{get_ignored_shows, set_image_from_path}; use utils::{get_ignored_shows, set_image_from_path};
use std::sync::Arc;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::sync::Arc;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ShowsPopulated { pub struct ShowsPopulated {

View File

@ -8,9 +8,9 @@ use open;
use rayon; use rayon;
use take_mut; use take_mut;
use hammond_data::{EpisodeWidgetQuery, Podcast};
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::utils::get_download_folder; use hammond_data::utils::get_download_folder;
use hammond_data::{EpisodeWidgetQuery, Podcast};
use app::Action; use app::Action;
use manager; use manager;
@ -21,8 +21,8 @@ use std::cell::RefCell;
use std::ops::DerefMut; use std::ops::DerefMut;
use std::path::Path; use std::path::Path;
use std::rc::Rc; use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::sync::{Arc, Mutex};
#[derive(Debug)] #[derive(Debug)]
pub struct EpisodeWidget { pub struct EpisodeWidget {
@ -370,8 +370,8 @@ fn total_size_helper(
// } // }
pub fn episodes_listbox(pd: Arc<Podcast>, sender: Sender<Action>) -> Result<gtk::ListBox, Error> { pub fn episodes_listbox(pd: Arc<Podcast>, sender: Sender<Action>) -> Result<gtk::ListBox, Error> {
use crossbeam_channel::TryRecvError::*;
use crossbeam_channel::bounded; use crossbeam_channel::bounded;
use crossbeam_channel::TryRecvError::*;
let count = dbqueries::get_pd_episodes_count(&pd)?; let count = dbqueries::get_pd_episodes_count(&pd)?;

View File

@ -1,7 +1,7 @@
mod show;
mod episode; mod episode;
mod episode_states; mod episode_states;
mod show;
pub use self::episode::EpisodeWidget; pub use self::episode::EpisodeWidget;
pub use self::show::ShowWidget;
pub use self::show::mark_all_watched; pub use self::show::mark_all_watched;
pub use self::show::ShowWidget;

View File

@ -5,15 +5,15 @@ use gtk::prelude::*;
use html2pango::markup_from_raw; use html2pango::markup_from_raw;
use open; use open;
use hammond_data::Podcast;
use hammond_data::dbqueries; use hammond_data::dbqueries;
use hammond_data::Podcast;
use app::Action; use app::Action;
use utils::set_image_from_path; use utils::set_image_from_path;
use widgets::episode::episodes_listbox; use widgets::episode::episodes_listbox;
use std::sync::Arc;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::sync::Arc;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ShowWidget { pub struct ShowWidget {

View File

@ -11,5 +11,3 @@ condense_wildcard_suffixes = false
format_strings = true format_strings = true
normalize_comments = true normalize_comments = true
reorder_imports = true reorder_imports = true
reorder_imported_names = true
reorder_imports_in_group = true