Feed: Remove unnecessary function wrapper

This commit is contained in:
Jordan Petridis 2018-09-02 21:27:05 +03:00
parent 9ef172390a
commit 1028d1334b
No known key found for this signature in database
GPG Key ID: E8523968931763BE

View File

@ -26,7 +26,7 @@ pub struct Feed {
impl Feed { impl Feed {
/// Index the contents of the RSS `Feed` into the database. /// Index the contents of the RSS `Feed` into the database.
pub fn index(self) -> impl Future<Item = (), Error = DataError> + Send { pub fn index(self) -> impl Future<Item = (), Error = DataError> + Send {
self.parse_podcast_async() ok(self.parse_podcast())
.and_then(|pd| pd.to_podcast()) .and_then(|pd| pd.to_podcast())
.and_then(move |pd| self.index_channel_items(pd)) .and_then(move |pd| self.index_channel_items(pd))
} }
@ -35,10 +35,6 @@ impl Feed {
NewShow::new(&self.channel, self.source_id) NewShow::new(&self.channel, self.source_id)
} }
fn parse_podcast_async(&self) -> impl Future<Item = NewShow, Error = DataError> + Send {
ok(self.parse_podcast())
}
fn index_channel_items(self, pd: Show) -> impl Future<Item = (), Error = DataError> + Send { fn index_channel_items(self, pd: Show) -> impl Future<Item = (), Error = DataError> + Send {
let stream = stream::iter_ok::<_, DataError>(self.channel.into_items()); let stream = stream::iter_ok::<_, DataError>(self.channel.into_items());