Skip to content

Commit e12b169

Browse files
Lenny222marijnh
Lenny222
authored andcommitted
implement str::is_whitespace using char::is_whitespace
1 parent 439e28b commit e12b169

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/libcore/str.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,7 @@ Function: is_whitespace
116116
Returns true if the string contains only whitespace
117117
*/
118118
fn is_whitespace(s: str) -> bool {
119-
let i = 0u;
120-
let len = char_len(s);
121-
while i < len {
122-
// FIXME: This is not how char_at works
123-
if !char::is_whitespace(char_at(s, i)) { ret false; }
124-
i += 1u;
125-
}
126-
ret true;
119+
ret loop_chars(s, char::is_whitespace);
127120
}
128121

129122
/*

0 commit comments

Comments
 (0)