From 77d4c2da730b6165093b7d3cd4dc1b6bbf72b036 Mon Sep 17 00:00:00 2001 From: Avril Date: Sun, 11 Oct 2020 05:32:55 +0100 Subject: [PATCH] removed redundant filter --- Cargo.toml | 2 +- src/feed.rs | 4 +--- src/sanitise/sentance.rs | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0c04205..cd93c39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "markov" -version = "0.5.3" +version = "0.5.4" description = "Generate string of text from Markov chain fed by stdin" authors = ["Avril "] edition = "2018" diff --git a/src/feed.rs b/src/feed.rs index 3db4c67..866c1bf 100644 --- a/src/feed.rs +++ b/src/feed.rs @@ -11,7 +11,6 @@ pub fn feed(chain: &mut Chain, what: impl AsRef, bounds: impl std:: if #[cfg(feature="split-sentance")] { let map = Sentance::new_iter(&what) //get each sentance in string .map(|what| what.words() - .filter(|word| !word.is_empty()) .map(|s| s.to_owned()).collect::>()); debug_assert!(!bounds.contains(&0), "Cannot allow 0 size feeds"); for map in map {// feed each sentance seperately @@ -24,8 +23,7 @@ pub fn feed(chain: &mut Chain, what: impl AsRef, bounds: impl std:: } } else { let map = Sentance::new_iter(&what) //get each sentance in string - .map(|what| what.words() - .filter(|word| !word.is_empty())) + .map(|what| what.words()) .flatten() // add all into one buffer .map(|s| s.to_owned()).collect::>(); debug_assert!(!bounds.contains(&0), "Cannot allow 0 size feeds"); diff --git a/src/sanitise/sentance.rs b/src/sanitise/sentance.rs index 2734234..cc1c364 100644 --- a/src/sanitise/sentance.rs +++ b/src/sanitise/sentance.rs @@ -77,7 +77,7 @@ impl Sentance } /// Get the words in this sentance - pub fn words(&self) -> impl Iterator + #[inline] pub fn words(&self) -> impl Iterator { Word::new_iter(self) }