Fix all the clippy warnings!
This commit is contained in:
@@ -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.");
|
||||
|
||||
@@ -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))]
|
||||
# Paths.
|
||||
#[allow(missing_debug_implementations)]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(|_| ())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user