cargo fmt

This commit is contained in:
Jordan Petridis 2018-08-27 21:08:29 +03:00
parent a2d8b88337
commit aa1d0161d3
No known key found for this signature in database
GPG Key ID: E8523968931763BE
2 changed files with 17 additions and 15 deletions

View File

@ -87,21 +87,22 @@ fn filter_episodes<'a, S>(
where
S: Stream<Item = IndexState<NewEpisode>, Error = DataError> + Send + 'a,
{
stream.filter_map(|state| match state {
IndexState::NotChanged => None,
// Update individual rows, and filter them
IndexState::Update((ref ep, rowid)) => {
ep.update(rowid)
.map_err(|err| error!("{}", err))
.map_err(|_| error!("Failed to index episode: {:?}.", ep.title()))
.ok();
stream
.filter_map(|state| match state {
IndexState::NotChanged => None,
// Update individual rows, and filter them
IndexState::Update((ref ep, rowid)) => {
ep.update(rowid)
.map_err(|err| error!("{}", err))
.map_err(|_| error!("Failed to index episode: {:?}.", ep.title()))
.ok();
None
},
IndexState::Index(s) => Some(s),
})
// only Index is left, collect them for batch index
.collect()
None
}
IndexState::Index(s) => Some(s),
})
// only Index is left, collect them for batch index
.collect()
}
fn batch_insert_episodes(episodes: &[NewEpisode]) {

View File

@ -217,7 +217,8 @@ impl NewEpisodeMinimal {
let enc = item.enclosure();
// Get the url
let uri = enc.map(|s| url_cleaner(s.url().trim()))
let uri = enc
.map(|s| url_cleaner(s.url().trim()))
// Fallback to Rss.Item.link if enclosure is None.
.or_else(|| item.link().map(|s| url_cleaner(s.trim())));