[librsvg: 3/10] Use str.replace() instead of map/match/collect .



commit cef86a9fe9a706ef32df863f826b325ceb022be7
Author: Jordan Petridis <jordanpetridis protonmail com>
Date:   Fri Dec 8 07:57:40 2017 +0200

    Use str.replace() instead of map/match/collect .

 rust/src/space.rs | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/rust/src/space.rs b/rust/src/space.rs
index 6bae26d..0dbc205 100644
--- a/rust/src/space.rs
+++ b/rust/src/space.rs
@@ -49,15 +49,8 @@ fn normalize_default(s: &str) -> String {
 // and "b") will produce a larger separation between "a" and "b" than
 // "a b" (one space between "a" and "b").
 fn normalize_preserve(s: &str) -> String {
-    s.chars()
-        .map(|ch| {
-            match ch {
-                '\n' | '\t' => ' ',
-
-                c => c
-            }
-        })
-        .collect()
+    let s = s.replace("\n", " ");
+    s.replace("\t", " ")
 }
 
 #[no_mangle]


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