[librsvg: 1/10] Replace split/filter on ' ' || '/t' with .split_whitespace method.



commit 24b41fae77dcffd78049ec451efac852604a365e
Author: Jordan Petridis <jordanpetridis protonmail com>
Date:   Fri Dec 8 06:07:51 2017 +0200

    Replace split/filter on ' ' || '/t' with .split_whitespace method.

 rust/src/space.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/rust/src/space.rs b/rust/src/space.rs
index 58b52a1..1b0dd2e 100644
--- a/rust/src/space.rs
+++ b/rust/src/space.rs
@@ -32,8 +32,8 @@ fn normalize_default(s: &str) -> String {
     s.chars()
         .filter(|ch| *ch != '\n')
         .collect::<String>()
-        .split(|ch| ch == ' ' || ch == '\t')
-        .filter(|s| s.len() > 0)
+        // split at whitespace, also trims whitespace.
+        .split_whitespace()
         .collect::<Vec<_>>()
         .join(" ")
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]