Fix all the clippy warnings!

This commit is contained in:
Jordan Petridis
2018-04-30 14:13:54 +03:00
parent d4d89a56e9
commit c96b39d597
19 changed files with 79 additions and 78 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
#![cfg_attr(feature = "cargo-clippy", allow(unit_arg))]
//! Index Feeds.
use futures::future::*;
@@ -53,7 +54,7 @@ impl Feed {
// Filter errors, Index updatable episodes, return insertables.
let insertables = filter_episodes(episodes);
// Batch index insertable episodes.
let idx = insertables.and_then(|eps| ok(batch_insert_episodes(eps)));
let idx = insertables.and_then(|eps| ok(batch_insert_episodes(&eps)));
Box::new(idx)
}
@@ -109,13 +110,13 @@ where
Box::new(list)
}
fn batch_insert_episodes(episodes: Vec<NewEpisode>) {
fn batch_insert_episodes(episodes: &[NewEpisode]) {
if episodes.is_empty() {
return;
};
info!("Indexing {} episodes.", episodes.len());
dbqueries::index_new_episodes(episodes.as_slice())
dbqueries::index_new_episodes(episodes)
.map_err(|err| {
error!("Failed batch indexng: {}", err);
info!("Fallign back to individual indexing.");
+2 -3
View File
@@ -1,6 +1,6 @@
#![recursion_limit = "1024"]
#![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(option_map_unit_fn))]
#![cfg_attr(
feature = "clippy",
warn(
@@ -76,8 +76,7 @@ pub use models::{Episode, EpisodeWidgetQuery, Podcast, PodcastCoverQuery, Source
// Set the user agent, See #53 for more
// Keep this in sync with Tor-browser releases
const USER_AGENT: &'static str =
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0";
const USER_AGENT: &str = "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0";
/// [XDG Base Direcotory](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) Paths.
#[allow(missing_debug_implementations)]
+3 -3
View File
@@ -181,7 +181,7 @@ impl Source {
let id = self.id();
let response = loop_fn(self, move |source| {
source
.request_constructor(client.clone(), ignore_etags)
.request_constructor(&client.clone(), ignore_etags)
.then(|res| match res {
Ok(response) => Ok(Loop::Break(response)),
Err(err) => match err {
@@ -195,7 +195,7 @@ impl Source {
});
let feed = response
.and_then(|res| response_to_channel(res))
.and_then(response_to_channel)
.and_then(move |chan| {
FeedBuilder::default()
.channel(chan)
@@ -211,7 +211,7 @@ impl Source {
// #bools_are_just_2variant_enmus
fn request_constructor(
self,
client: Client<HttpsConnector<HttpConnector>>,
client: &Client<HttpsConnector<HttpConnector>>,
ignore_etags: bool,
) -> Box<Future<Item = Response, Error = DataError>> {
// FIXME: remove unwrap somehow
+2 -2
View File
@@ -49,7 +49,7 @@ type HttpsClient = Client<HttpsConnector<HttpConnector>>;
pub fn pipeline<'a, S>(
sources: S,
ignore_etags: bool,
client: HttpsClient,
client: &HttpsClient,
) -> Box<Future<Item = Vec<()>, Error = DataError> + 'a>
where
S: Stream<Item = Source, Error = DataError> + 'a,
@@ -79,7 +79,7 @@ where
.build(&handle);
let stream = iter_ok::<_, DataError>(sources);
let p = pipeline(stream, ignore_etags, client);
let p = pipeline(stream, ignore_etags, &client);
core.run(p).map(|_| ())
}