Remove more dead code.
This commit is contained in:
parent
e07e35110d
commit
7a3a148359
@ -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::<String>()
|
||||
}
|
||||
|
||||
/// Returns the URI of a Podcast Downloads given it's title.
|
||||
pub fn get_download_folder(pd_title: &str) -> Result<String, DataError> {
|
||||
// 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]
|
||||
|
||||
@ -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)));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user