From bb467b7abadeba2ee8ee6362467318b9578ce9c9 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Sat, 3 Mar 2018 16:45:37 +0200 Subject: [PATCH] Rustfmt. --- hammond-data/src/database.rs | 7 +--- hammond-data/src/models/new_episode.rs | 49 ++++++++++------------ hammond-data/src/models/new_podcast.rs | 57 ++++++++++++-------------- hammond-gtk/src/manager.rs | 5 +-- hammond-gtk/src/utils.rs | 5 +-- 5 files changed, 53 insertions(+), 70 deletions(-) diff --git a/hammond-data/src/database.rs b/hammond-data/src/database.rs index d6e5be0..8db7e6a 100644 --- a/hammond-data/src/database.rs +++ b/hammond-data/src/database.rs @@ -16,7 +16,7 @@ type Pool = r2d2::Pool>; embed_migrations!("migrations/"); -lazy_static!{ +lazy_static! { static ref POOL: Pool = init_pool(DB_PATH.to_str().unwrap()); } @@ -30,10 +30,7 @@ extern crate tempdir; #[cfg(test)] lazy_static! { - static ref TEMPDIR: tempdir::TempDir = { - tempdir::TempDir::new("hammond_unit_test").unwrap() - }; - + static ref TEMPDIR: tempdir::TempDir = { tempdir::TempDir::new("hammond_unit_test").unwrap() }; static ref DB_PATH: PathBuf = TEMPDIR.path().join("hammond.db"); } diff --git a/hammond-data/src/models/new_episode.rs b/hammond-data/src/models/new_episode.rs index b0ce47c..ad1a12d 100644 --- a/hammond-data/src/models/new_episode.rs +++ b/hammond-data/src/models/new_episode.rs @@ -311,7 +311,6 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_MINIMAL_INTERCEPTED_2: NewEpisodeMinimal = { NewEpisodeMinimalBuilder::default() .title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America") @@ -325,13 +324,12 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_INTERCEPTED_1: NewEpisode = { - let descr = "NSA whistleblower Edward Snowden discusses the massive Equifax data breach \ - and allegations of Russian interference in the US election. Commentator \ - Shaun King explains his call for a boycott of the NFL and talks about his \ - campaign to bring violent neo-Nazis to justice. Rapper Open Mike Eagle \ - performs."; + let descr = "NSA whistleblower Edward Snowden discusses the massive Equifax data \ + breach and allegations of Russian interference in the US election. \ + Commentator Shaun King explains his call for a boycott of the NFL and \ + talks about his campaign to bring violent neo-Nazis to justice. Rapper \ + Open Mike Eagle performs."; NewEpisodeBuilder::default() .title("The Super Bowl of Racism") @@ -347,16 +345,15 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_INTERCEPTED_2: NewEpisode = { let descr = "This week on Intercepted: Jeremy gives an update on the aftermath of \ - Blackwater’s 2007 massacre of Iraqi civilians. Intercept reporter Lee Fang \ - lays out how a network of libertarian think tanks called the Atlas Network \ - is insidiously shaping political infrastructure in Latin America. We speak \ - with attorney and former Hugo Chavez adviser Eva Golinger about the \ - Venezuela\'s political turmoil.And we hear Claudia Lizardo of the \ - Caracas-based band, La Pequeña Revancha, talk about her music and hopes for \ - Venezuela."; + Blackwater’s 2007 massacre of Iraqi civilians. Intercept reporter Lee \ + Fang lays out how a network of libertarian think tanks called the Atlas \ + Network is insidiously shaping political infrastructure in Latin \ + America. We speak with attorney and former Hugo Chavez adviser Eva \ + Golinger about the Venezuela\'s political turmoil.And we hear Claudia \ + Lizardo of the Caracas-based band, La Pequeña Revancha, talk about her \ + music and hopes for Venezuela."; NewEpisodeBuilder::default() .title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America") @@ -372,7 +369,6 @@ mod tests { .build() .unwrap() }; - static ref UPDATED_DURATION_INTERCEPTED_1: NewEpisode = { NewEpisodeBuilder::default() .title("The Super Bowl of Racism") @@ -388,7 +384,6 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_MINIMAL_LUP_1: NewEpisodeMinimal = { NewEpisodeMinimalBuilder::default() .title("Hacking Devices with Kali Linux | LUP 214") @@ -402,7 +397,6 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_MINIMAL_LUP_2: NewEpisodeMinimal = { NewEpisodeMinimalBuilder::default() .title("Gnome Does it Again | LUP 213") @@ -416,12 +410,11 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_LUP_1: NewEpisode = { let descr = "Audit your network with a couple of easy commands on Kali Linux. Chris \ - decides to blow off a little steam by attacking his IoT devices, Wes has the \ - scope on Equifax blaming open source & the Beard just saved the show. \ - It’s a really packed episode!"; + decides to blow off a little steam by attacking his IoT devices, Wes has \ + the scope on Equifax blaming open source & the Beard just saved the \ + show. It’s a really packed episode!"; NewEpisodeBuilder::default() .title("Hacking Devices with Kali Linux | LUP 214") @@ -437,13 +430,13 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_LUP_2: NewEpisode = { - let descr = "The Gnome project is about to solve one of our audience's biggest Wayland’s \ - concerns. But as the project takes on a new level of relevance, decisions for the \ - next version of Gnome have us worried about the future.\nPlus we chat with Wimpy \ - about the Ubuntu Rally in NYC, Microsoft’s sneaky move to turn Windows 10 into the \ - “ULTIMATE LINUX RUNTIME”, community news & more!"; + let descr = "The Gnome project is about to solve one of our audience's biggest \ + Wayland’s concerns. But as the project takes on a new level of \ + relevance, decisions for the next version of Gnome have us worried about \ + the future.\nPlus we chat with Wimpy about the Ubuntu Rally in NYC, \ + Microsoft’s sneaky move to turn Windows 10 into the “ULTIMATE LINUX \ + RUNTIME”, community news & more!"; NewEpisodeBuilder::default() .title("Gnome Does it Again | LUP 213") diff --git a/hammond-data/src/models/new_podcast.rs b/hammond-data/src/models/new_podcast.rs index ce2d1c6..22f8d51 100644 --- a/hammond-data/src/models/new_podcast.rs +++ b/hammond-data/src/models/new_podcast.rs @@ -162,13 +162,14 @@ mod tests { use std::io::BufReader; // Pre-built expected NewPodcast structs. - lazy_static!{ + lazy_static! { static ref EXPECTED_INTERCEPTED: NewPodcast = { let descr = "The people behind The Intercept’s fearless reporting and incisive \ - commentary—Jeremy Scahill, Glenn Greenwald, Betsy Reed and others—discuss \ - the crucial issues of our time: national security, civil liberties, foreign \ - policy, and criminal justice. Plus interviews with artists, thinkers, and \ - newsmakers who challenge our preconceptions about the world we live in."; + commentary—Jeremy Scahill, Glenn Greenwald, Betsy Reed and \ + others—discuss the crucial issues of our time: national security, civil \ + liberties, foreign policy, and criminal justice. Plus interviews with \ + artists, thinkers, and newsmakers who challenge our preconceptions about \ + the world we live in."; NewPodcastBuilder::default() .title("Intercepted with Jeremy Scahill") @@ -183,11 +184,10 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_LUP: NewPodcast = { - let descr = "An open show powered by community LINUX Unplugged takes the best attributes \ - of open collaboration and focuses them into a weekly lifestyle show about \ - Linux."; + let descr = "An open show powered by community LINUX Unplugged takes the best \ + attributes of open collaboration and focuses them into a weekly \ + lifestyle show about Linux."; NewPodcastBuilder::default() .title("LINUX Unplugged Podcast") @@ -200,17 +200,16 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_TIPOFF: NewPodcast = { - let desc = "Welcome to The Tip Off- the podcast where we take you behind the scenes of \ - some of the best investigative journalism from recent years. Each episode \ - we’ll be digging into an investigative scoop- hearing from the journalists \ - behind the work as they tell us about the leads, the dead-ends and of course, \ - the tip offs. There’ll be car chases, slammed doors, terrorist cells, \ - meetings in dimly lit bars and cafes, wrangling with despotic regimes and \ - much more. So if you’re curious about the fun, complicated detective work \ - that goes into doing great investigative journalism- then this is the podcast \ - for you."; + let desc = "Welcome to The Tip Off- the podcast where we take you behind the scenes \ + of some of the best investigative journalism from recent years. Each \ + episode we’ll be digging into an investigative scoop- hearing from the \ + journalists behind the work as they tell us about the leads, the \ + dead-ends and of course, the tip offs. There’ll be car chases, slammed \ + doors, terrorist cells, meetings in dimly lit bars and cafes, wrangling \ + with despotic regimes and much more. So if you’re curious about the fun, \ + complicated detective work that goes into doing great investigative \ + journalism- then this is the podcast for you."; NewPodcastBuilder::default() .title("The Tip Off") @@ -223,15 +222,13 @@ mod tests { .source_id(42) .build() .unwrap() - }; - static ref EXPECTED_STARS: NewPodcast = { - let descr = "

The first audio drama from Tor Labs and Gideon Media, Steal the Stars is \ - a gripping noir science fiction thriller in 14 episodes: Forbidden love, a \ - crashed UFO, an alien body, and an impossible heist unlike any ever \ - attempted - scripted by Mac Rogers, the award-winning playwright and writer \ - of the multi-million download The Message and LifeAfter.

"; + let descr = "

The first audio drama from Tor Labs and Gideon Media, Steal the Stars \ + is a gripping noir science fiction thriller in 14 episodes: Forbidden \ + love, a crashed UFO, an alien body, and an impossible heist unlike any \ + ever attempted - scripted by Mac Rogers, the award-winning playwright \ + and writer of the multi-million download The Message and LifeAfter.

"; let img = "https://dfkfj8j276wwv.cloudfront.net/images/2c/5f/a0/1a/2c5fa01a-ae78-4a8c-\ b183-7311d2e436c3/b3a4aa57a576bb662191f2a6bc2a436c8c4ae256ecffaff5c4c54fd42e\ 923914941c264d01efb1833234b52c9530e67d28a8cebbe3d11a4bc0fbbdf13ecdf1c3.jpeg"; @@ -245,11 +242,10 @@ mod tests { .build() .unwrap() }; - static ref EXPECTED_CODE: NewPodcast = { - let descr = "A podcast about humans and technology. Panelists: Coraline Ada Ehmke, David \ - Brady, Jessica Kerr, Jay Bobo, Astrid Countee and Sam Livingston-Gray. \ - Brought to you by @therubyrep."; + let descr = "A podcast about humans and technology. Panelists: Coraline Ada Ehmke, \ + David Brady, Jessica Kerr, Jay Bobo, Astrid Countee and Sam \ + Livingston-Gray. Brought to you by @therubyrep."; NewPodcastBuilder::default() .title("Greater Than Code") @@ -262,7 +258,6 @@ mod tests { .build() .unwrap() }; - static ref UPDATED_DESC_INTERCEPTED: NewPodcast = { NewPodcastBuilder::default() .title("Intercepted with Jeremy Scahill") diff --git a/hammond-gtk/src/manager.rs b/hammond-gtk/src/manager.rs index a9d70fe..1c86a1e 100644 --- a/hammond-gtk/src/manager.rs +++ b/hammond-gtk/src/manager.rs @@ -73,9 +73,8 @@ impl DownloadProgress for Progress { } lazy_static! { - pub static ref ACTIVE_DOWNLOADS: Arc>>>> = { - Arc::new(RwLock::new(HashMap::new())) - }; + pub static ref ACTIVE_DOWNLOADS: Arc>>>> = + { Arc::new(RwLock::new(HashMap::new())) }; } pub fn add(id: i32, directory: &str, sender: Sender) -> Result<(), Error> { diff --git a/hammond-gtk/src/utils.rs b/hammond-gtk/src/utils.rs index f2b0876..26ee2be 100644 --- a/hammond-gtk/src/utils.rs +++ b/hammond-gtk/src/utils.rs @@ -74,9 +74,8 @@ fn refresh_feed(source: Option>, sender: Sender) -> Result<( } lazy_static! { - static ref CACHED_PIXBUFS: RwLock>>> = { - RwLock::new(HashMap::new()) - }; + static ref CACHED_PIXBUFS: RwLock>>> = + { RwLock::new(HashMap::new()) }; } // Since gdk_pixbuf::Pixbuf is refference counted and every episode,