cargo fmt

This commit is contained in:
Jordan Petridis 2018-08-02 07:09:43 +03:00
parent 24983ba3af
commit f695ba4605
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
7 changed files with 19 additions and 37 deletions

View File

@ -46,4 +46,4 @@
] ]
} }
] ]
} }

View File

@ -111,8 +111,7 @@ pub fn get_episode_widget_from_rowid(ep_id: i32) -> Result<EpisodeWidgetModel, D
episodes episodes
.select(( .select((
rowid, title, uri, local_uri, epoch, length, duration, played, show_id, rowid, title, uri, local_uri, epoch, length, duration, played, show_id,
)) )).filter(rowid.eq(ep_id))
.filter(rowid.eq(ep_id))
.get_result::<EpisodeWidgetModel>(&con) .get_result::<EpisodeWidgetModel>(&con)
.map_err(From::from) .map_err(From::from)
} }

View File

@ -114,8 +114,7 @@ fn batch_insert_episodes(episodes: &[NewEpisode]) {
.map_err(|err| { .map_err(|err| {
error!("Failed batch indexng: {}", err); error!("Failed batch indexng: {}", err);
info!("Fallign back to individual indexing."); info!("Fallign back to individual indexing.");
}) }).unwrap_or_else(|_| {
.unwrap_or_else(|_| {
episodes.iter().for_each(|ep| { episodes.iter().for_each(|ep| {
ep.index() ep.index()
.map_err(|err| error!("Error: {}.", err)) .map_err(|err| error!("Error: {}.", err))
@ -180,8 +179,7 @@ mod tests {
// Create and insert a Source into db // Create and insert a Source into db
let s = Source::from_url(url).unwrap(); let s = Source::from_url(url).unwrap();
get_feed(path, s.id()) get_feed(path, s.id())
}) }).collect();
.collect();
let mut core = Core::new().unwrap(); let mut core = Core::new().unwrap();
// Index the channels // Index the channels

View File

@ -330,8 +330,7 @@ mod tests {
.title("The Super Bowl of Racism") .title("The Super Bowl of Racism")
.uri(Some(String::from( .uri(Some(String::from(
"http://traffic.megaphone.fm/PPY6458293736.mp3", "http://traffic.megaphone.fm/PPY6458293736.mp3",
))) ))).guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
.guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
.epoch(1505296800) .epoch(1505296800)
.length(Some(66738886)) .length(Some(66738886))
.duration(Some(4171)) .duration(Some(4171))
@ -344,8 +343,7 @@ mod tests {
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America") .title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
.uri(Some(String::from( .uri(Some(String::from(
"http://traffic.megaphone.fm/FL5331443769.mp3", "http://traffic.megaphone.fm/FL5331443769.mp3",
))) ))).guid(Some(String::from("7c207a24-e33f-11e6-9438-eb45dcf36a1d")))
.guid(Some(String::from("7c207a24-e33f-11e6-9438-eb45dcf36a1d")))
.epoch(1502272800) .epoch(1502272800)
.length(Some(67527575)) .length(Some(67527575))
.duration(Some(4415)) .duration(Some(4415))
@ -364,8 +362,7 @@ mod tests {
.title("The Super Bowl of Racism") .title("The Super Bowl of Racism")
.uri(Some(String::from( .uri(Some(String::from(
"http://traffic.megaphone.fm/PPY6458293736.mp3", "http://traffic.megaphone.fm/PPY6458293736.mp3",
))) ))).description(Some(String::from(descr)))
.description(Some(String::from(descr)))
.guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24"))) .guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
.length(Some(66738886)) .length(Some(66738886))
.epoch(1505296800) .epoch(1505296800)
@ -388,8 +385,7 @@ mod tests {
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America") .title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
.uri(Some(String::from( .uri(Some(String::from(
"http://traffic.megaphone.fm/FL5331443769.mp3", "http://traffic.megaphone.fm/FL5331443769.mp3",
))) ))).description(Some(String::from(descr)))
.description(Some(String::from(descr)))
.guid(Some(String::from("7c207a24-e33f-11e6-9438-eb45dcf36a1d"))) .guid(Some(String::from("7c207a24-e33f-11e6-9438-eb45dcf36a1d")))
.length(Some(67527575)) .length(Some(67527575))
.epoch(1502272800) .epoch(1502272800)
@ -403,8 +399,7 @@ mod tests {
.title("The Super Bowl of Racism") .title("The Super Bowl of Racism")
.uri(Some(String::from( .uri(Some(String::from(
"http://traffic.megaphone.fm/PPY6458293736.mp3", "http://traffic.megaphone.fm/PPY6458293736.mp3",
))) ))).description(Some(String::from("New description")))
.description(Some(String::from("New description")))
.guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24"))) .guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
.length(Some(66738886)) .length(Some(66738886))
.epoch(1505296800) .epoch(1505296800)
@ -418,8 +413,7 @@ mod tests {
.title("Hacking Devices with Kali Linux | LUP 214") .title("Hacking Devices with Kali Linux | LUP 214")
.uri(Some(String::from( .uri(Some(String::from(
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0214.mp3", "http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0214.mp3",
))) ))).guid(Some(String::from("78A682B4-73E8-47B8-88C0-1BE62DD4EF9D")))
.guid(Some(String::from("78A682B4-73E8-47B8-88C0-1BE62DD4EF9D")))
.length(Some(46479789)) .length(Some(46479789))
.epoch(1505280282) .epoch(1505280282)
.duration(Some(5733)) .duration(Some(5733))
@ -432,8 +426,7 @@ mod tests {
.title("Gnome Does it Again | LUP 213") .title("Gnome Does it Again | LUP 213")
.uri(Some(String::from( .uri(Some(String::from(
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0213.mp3", "http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0213.mp3",
))) ))).guid(Some(String::from("1CE57548-B36C-4F14-832A-5D5E0A24E35B")))
.guid(Some(String::from("1CE57548-B36C-4F14-832A-5D5E0A24E35B")))
.epoch(1504670247) .epoch(1504670247)
.length(Some(36544272)) .length(Some(36544272))
.duration(Some(4491)) .duration(Some(4491))
@ -451,8 +444,7 @@ mod tests {
.title("Hacking Devices with Kali Linux | LUP 214") .title("Hacking Devices with Kali Linux | LUP 214")
.uri(Some(String::from( .uri(Some(String::from(
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0214.mp3", "http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0214.mp3",
))) ))).description(Some(String::from(descr)))
.description(Some(String::from(descr)))
.guid(Some(String::from("78A682B4-73E8-47B8-88C0-1BE62DD4EF9D"))) .guid(Some(String::from("78A682B4-73E8-47B8-88C0-1BE62DD4EF9D")))
.length(Some(46479789)) .length(Some(46479789))
.epoch(1505280282) .epoch(1505280282)
@ -473,8 +465,7 @@ mod tests {
.title("Gnome Does it Again | LUP 213") .title("Gnome Does it Again | LUP 213")
.uri(Some(String::from( .uri(Some(String::from(
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0213.mp3", "http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0213.mp3",
))) ))).description(Some(String::from(descr)))
.description(Some(String::from(descr)))
.guid(Some(String::from("1CE57548-B36C-4F14-832A-5D5E0A24E35B"))) .guid(Some(String::from("1CE57548-B36C-4F14-832A-5D5E0A24E35B")))
.length(Some(36544272)) .length(Some(36544272))
.epoch(1504670247) .epoch(1504670247)

View File

@ -199,8 +199,7 @@ mod tests {
.description(descr) .description(descr)
.image_uri(Some(String::from( .image_uri(Some(String::from(
"http://www.jupiterbroadcasting.com/images/LASUN-Badge1400.jpg", "http://www.jupiterbroadcasting.com/images/LASUN-Badge1400.jpg",
))) ))).source_id(42)
.source_id(42)
.build() .build()
.unwrap() .unwrap()
}; };
@ -222,8 +221,7 @@ mod tests {
.image_uri(Some(String::from( .image_uri(Some(String::from(
"https://imagecdn.acast.com/image?h=1500&w=1500&source=http%3A%2F%2Fi1.sndcdn.\ "https://imagecdn.acast.com/image?h=1500&w=1500&source=http%3A%2F%2Fi1.sndcdn.\
com%2Favatars-000317856075-a2coqz-original.jpg", com%2Favatars-000317856075-a2coqz-original.jpg",
))) ))).source_id(42)
.source_id(42)
.build() .build()
.unwrap() .unwrap()
}; };
@ -257,8 +255,7 @@ mod tests {
.description(descr) .description(descr)
.image_uri(Some(String::from( .image_uri(Some(String::from(
"http://www.greaterthancode.com/wp-content/uploads/2016/10/code1400-4.jpg", "http://www.greaterthancode.com/wp-content/uploads/2016/10/code1400-4.jpg",
))) ))).source_id(42)
.source_id(42)
.build() .build()
.unwrap() .unwrap()
}; };

View File

@ -42,8 +42,7 @@ pub fn import_to_db<R: Read>(reader: R) -> Result<Vec<Source>, reader::Error> {
} }
s.ok() s.ok()
}) }).collect();
.collect();
Ok(feeds) Ok(feeds)
} }
@ -92,8 +91,7 @@ pub fn extract_sources<R: Read>(reader: R) -> Result<HashSet<Opml>, reader::Erro
} }
Err(err) => Err(err), Err(err) => Err(err),
_ => Ok(()), _ => Ok(()),
}) }).collect::<Result<Vec<_>, reader::Error>>()?;
.collect::<Result<Vec<_>, reader::Error>>()?;
Ok(list) Ok(list)
} }

View File

@ -25,8 +25,7 @@ fn download_checker() -> Result<(), DataError> {
return Some(ep); return Some(ep);
} }
None None
}) }).for_each(|ep| {
.for_each(|ep| {
ep.set_local_uri(None); ep.set_local_uri(None);
ep.save() ep.save()
.map_err(|err| error!("{}", err)) .map_err(|err| error!("{}", err))