Replaced annoying let _ = map/collect; paterns with for_each
This commit is contained in:
parent
108f667d47
commit
f70f707a69
@ -79,12 +79,9 @@ pub fn index_loop(db: SqliteConnection) -> Result<()> {
|
|||||||
|
|
||||||
let mut f = fetch_feeds(m.clone())?;
|
let mut f = fetch_feeds(m.clone())?;
|
||||||
|
|
||||||
// TODO: replace maps with for_each
|
f.par_iter_mut().for_each(|&mut (ref mut req, ref source)| {
|
||||||
let _: Vec<_> = f.par_iter_mut()
|
|
||||||
.map(|&mut (ref mut req, ref source)| {
|
|
||||||
complete_index_from_source(req, source, m.clone()).unwrap()
|
complete_index_from_source(req, source, m.clone()).unwrap()
|
||||||
})
|
});
|
||||||
.collect();
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -111,13 +108,11 @@ fn complete_index_from_source(
|
|||||||
.map(|x| feedparser::parse_episode(&x, pd.id()).unwrap())
|
.map(|x| feedparser::parse_episode(&x, pd.id()).unwrap())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let _: Vec<_> = foo.par_iter()
|
foo.par_iter().for_each(|x| {
|
||||||
.map(|x| {
|
|
||||||
let dbmutex = mutex.clone();
|
let dbmutex = mutex.clone();
|
||||||
let db = dbmutex.lock().unwrap();
|
let db = dbmutex.lock().unwrap();
|
||||||
index_episode(&db, &x).unwrap();
|
index_episode(&db, &x).unwrap();
|
||||||
})
|
});
|
||||||
.collect();
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user