about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLenny222 <github@kudling.de>2012-01-02 21:14:20 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2012-01-04 09:32:59 +0100
commite12b1692478e490fbffdc1aad86e6de627425f8d (patch)
tree42dde33be038b368d1703bb37b5cef2602622f9c /src
parent439e28b7510919e2ff69c82acef387d08cd1e947 (diff)
downloadrust-e12b1692478e490fbffdc1aad86e6de627425f8d.tar.gz
rust-e12b1692478e490fbffdc1aad86e6de627425f8d.zip
implement str::is_whitespace using char::is_whitespace
Diffstat (limited to 'src')
-rw-r--r--src/libcore/str.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 449cc95aa21..de29f297192 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -116,14 +116,7 @@ Function: is_whitespace
 Returns true if the string contains only whitespace
 */
 fn is_whitespace(s: str) -> bool {
-    let i = 0u;
-    let len = char_len(s);
-    while i < len {
-        // FIXME: This is not how char_at works
-        if !char::is_whitespace(char_at(s, i)) { ret false; }
-        i += 1u;
-    }
-    ret true;
+    ret loop_chars(s, char::is_whitespace);
 }
 
 /*