From f695ba460589dbfac75a7642320cf61be2ec37ad Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Thu, 2 Aug 2018 07:09:43 +0300 Subject: [PATCH] cargo fmt --- org.gnome.Podcasts.json | 2 +- podcasts-data/src/dbqueries.rs | 3 +-- podcasts-data/src/feed.rs | 6 ++---- podcasts-data/src/models/new_episode.rs | 27 +++++++++---------------- podcasts-data/src/models/new_show.rs | 9 +++------ podcasts-data/src/opml.rs | 6 ++---- podcasts-data/src/utils.rs | 3 +-- 7 files changed, 19 insertions(+), 37 deletions(-) diff --git a/org.gnome.Podcasts.json b/org.gnome.Podcasts.json index 8e5fbe1..c0c4e7f 100644 --- a/org.gnome.Podcasts.json +++ b/org.gnome.Podcasts.json @@ -46,4 +46,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/podcasts-data/src/dbqueries.rs b/podcasts-data/src/dbqueries.rs index 635ba60..fce5f88 100644 --- a/podcasts-data/src/dbqueries.rs +++ b/podcasts-data/src/dbqueries.rs @@ -111,8 +111,7 @@ pub fn get_episode_widget_from_rowid(ep_id: i32) -> Result(&con) .map_err(From::from) } diff --git a/podcasts-data/src/feed.rs b/podcasts-data/src/feed.rs index 2abcc29..69a43a8 100644 --- a/podcasts-data/src/feed.rs +++ b/podcasts-data/src/feed.rs @@ -114,8 +114,7 @@ fn batch_insert_episodes(episodes: &[NewEpisode]) { .map_err(|err| { error!("Failed batch indexng: {}", err); info!("Fallign back to individual indexing."); - }) - .unwrap_or_else(|_| { + }).unwrap_or_else(|_| { episodes.iter().for_each(|ep| { ep.index() .map_err(|err| error!("Error: {}.", err)) @@ -180,8 +179,7 @@ mod tests { // Create and insert a Source into db let s = Source::from_url(url).unwrap(); get_feed(path, s.id()) - }) - .collect(); + }).collect(); let mut core = Core::new().unwrap(); // Index the channels diff --git a/podcasts-data/src/models/new_episode.rs b/podcasts-data/src/models/new_episode.rs index 2b88ddb..c8b330b 100644 --- a/podcasts-data/src/models/new_episode.rs +++ b/podcasts-data/src/models/new_episode.rs @@ -330,8 +330,7 @@ mod tests { .title("The Super Bowl of Racism") .uri(Some(String::from( "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) .length(Some(66738886)) .duration(Some(4171)) @@ -344,8 +343,7 @@ mod tests { .title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America") .uri(Some(String::from( "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) .length(Some(67527575)) .duration(Some(4415)) @@ -364,8 +362,7 @@ mod tests { .title("The Super Bowl of Racism") .uri(Some(String::from( "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"))) .length(Some(66738886)) .epoch(1505296800) @@ -388,8 +385,7 @@ mod tests { .title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America") .uri(Some(String::from( "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"))) .length(Some(67527575)) .epoch(1502272800) @@ -403,8 +399,7 @@ mod tests { .title("The Super Bowl of Racism") .uri(Some(String::from( "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"))) .length(Some(66738886)) .epoch(1505296800) @@ -418,8 +413,7 @@ mod tests { .title("Hacking Devices with Kali Linux | LUP 214") .uri(Some(String::from( "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)) .epoch(1505280282) .duration(Some(5733)) @@ -432,8 +426,7 @@ mod tests { .title("Gnome Does it Again | LUP 213") .uri(Some(String::from( "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) .length(Some(36544272)) .duration(Some(4491)) @@ -451,8 +444,7 @@ mod tests { .title("Hacking Devices with Kali Linux | LUP 214") .uri(Some(String::from( "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"))) .length(Some(46479789)) .epoch(1505280282) @@ -473,8 +465,7 @@ mod tests { .title("Gnome Does it Again | LUP 213") .uri(Some(String::from( "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"))) .length(Some(36544272)) .epoch(1504670247) diff --git a/podcasts-data/src/models/new_show.rs b/podcasts-data/src/models/new_show.rs index fd916a0..bc43852 100644 --- a/podcasts-data/src/models/new_show.rs +++ b/podcasts-data/src/models/new_show.rs @@ -199,8 +199,7 @@ mod tests { .description(descr) .image_uri(Some(String::from( "http://www.jupiterbroadcasting.com/images/LASUN-Badge1400.jpg", - ))) - .source_id(42) + ))).source_id(42) .build() .unwrap() }; @@ -222,8 +221,7 @@ mod tests { .image_uri(Some(String::from( "https://imagecdn.acast.com/image?h=1500&w=1500&source=http%3A%2F%2Fi1.sndcdn.\ com%2Favatars-000317856075-a2coqz-original.jpg", - ))) - .source_id(42) + ))).source_id(42) .build() .unwrap() }; @@ -257,8 +255,7 @@ mod tests { .description(descr) .image_uri(Some(String::from( "http://www.greaterthancode.com/wp-content/uploads/2016/10/code1400-4.jpg", - ))) - .source_id(42) + ))).source_id(42) .build() .unwrap() }; diff --git a/podcasts-data/src/opml.rs b/podcasts-data/src/opml.rs index e17b88f..12ff486 100644 --- a/podcasts-data/src/opml.rs +++ b/podcasts-data/src/opml.rs @@ -42,8 +42,7 @@ pub fn import_to_db(reader: R) -> Result, reader::Error> { } s.ok() - }) - .collect(); + }).collect(); Ok(feeds) } @@ -92,8 +91,7 @@ pub fn extract_sources(reader: R) -> Result, reader::Erro } Err(err) => Err(err), _ => Ok(()), - }) - .collect::, reader::Error>>()?; + }).collect::, reader::Error>>()?; Ok(list) } diff --git a/podcasts-data/src/utils.rs b/podcasts-data/src/utils.rs index 5e13d0e..35efb39 100644 --- a/podcasts-data/src/utils.rs +++ b/podcasts-data/src/utils.rs @@ -25,8 +25,7 @@ fn download_checker() -> Result<(), DataError> { return Some(ep); } None - }) - .for_each(|ep| { + }).for_each(|ep| { ep.set_local_uri(None); ep.save() .map_err(|err| error!("{}", err))