From 7a3a148359973331f7a435735fbe3d2e90aab472 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 3 Apr 2018 11:35:40 +0300 Subject: [PATCH] Remove more dead code. --- hammond-data/src/utils.rs | 34 --------------------------------- hammond-gtk/src/widgets/show.rs | 7 ------- 2 files changed, 41 deletions(-) diff --git a/hammond-data/src/utils.rs b/hammond-data/src/utils.rs index d17ee09..80cc5ae 100644 --- a/hammond-data/src/utils.rs +++ b/hammond-data/src/utils.rs @@ -110,22 +110,6 @@ pub fn url_cleaner(s: &str) -> String { } } -/// Helper functions that strips extra spaces and newlines and ignores the tabs. -#[allow(match_same_arms)] -pub fn replace_extra_spaces(s: &str) -> String { - s.trim() - .chars() - .filter(|ch| *ch != '\t') - .coalesce(|current, next| match (current, next) { - ('\n', '\n') => Ok('\n'), - ('\n', ' ') => Ok('\n'), - (' ', '\n') => Ok('\n'), - (' ', ' ') => Ok(' '), - (_, _) => Err((current, next)), - }) - .collect::() -} - /// Returns the URI of a Podcast Downloads given it's title. pub fn get_download_folder(pd_title: &str) -> Result { // It might be better to make it a hash of the title or the podcast rowid @@ -296,24 +280,6 @@ mod tests { assert_eq!(url_cleaner(&format!(" {}\t\n", bad_url)), good_url); } - #[test] - fn test_whitespace() { - let bad_txt = "1 2 3 4 5"; - let valid_txt = "1 2 3 4 5"; - - assert_eq!(replace_extra_spaces(&bad_txt), valid_txt); - - let bad_txt = "1 2 3 \n 4 5\n"; - let valid_txt = "1 2 3\n4 5"; - - assert_eq!(replace_extra_spaces(&bad_txt), valid_txt); - - let bad_txt = "1 2 3 \n\n\n \n 4 5\n"; - let valid_txt = "1 2 3\n4 5"; - - assert_eq!(replace_extra_spaces(&bad_txt), valid_txt); - } - #[test] // This test needs access to local system so we ignore it by default. #[ignore] diff --git a/hammond-gtk/src/widgets/show.rs b/hammond-gtk/src/widgets/show.rs index 36236ca..6c38c95 100644 --- a/hammond-gtk/src/widgets/show.rs +++ b/hammond-gtk/src/widgets/show.rs @@ -1,4 +1,3 @@ -// use dissolve; use failure::Error; // use glib; use ammonia; @@ -9,11 +8,9 @@ use open; use hammond_data::Podcast; use hammond_data::dbqueries; -// use hammond_data::utils::replace_extra_spaces; use app::Action; use utils::set_image_from_path; -// use utils::set_image_from_path; use widgets::episode::episodes_listbox; use std::sync::Arc; @@ -121,10 +118,6 @@ impl ShowWidget { /// Set the descripton text. fn set_description(&self, text: &str) { - // TODO: Temporary solution until we render html urls/bold/italic probably with - // markup. - // let desc = dissolve::strip_html_tags(text).join(" "); - // self.description.set_text(&replace_extra_spaces(&desc)); self.description .set_markup(&ammonia::clean(&html_to_pango_markup(text))); }