Skip to content

Commit e0cba93

Browse files
killerswanbrson
authored andcommitted
---
yaml --- r: 7951 b: refs/heads/snap-stage3 c: 1f795ff h: refs/heads/master i: 7949: ad96c98 7947: a009d22 7943: 43596e5 7935: 4c28fc5 v: v3
1 parent 6573f73 commit e0cba93

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a8b657397aa9cd4b85ef68cc11b5ce48ee99d3ce
4+
refs/heads/snap-stage3: 1f795ff3b0c0cac31c1d9fd2406d0d53e774683a
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/libcore/str.rs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -674,30 +674,18 @@ fn windowed(nn: uint, ss: str) -> [str] {
674674
Function: to_lower
675675
676676
Convert a string to lowercase
677-
678-
FIXME: rewrite with map
679677
*/
680678
fn to_lower(s: str) -> str {
681-
let outstr = "";
682-
chars_iter(s) { |c|
683-
push_char(outstr, char::to_lower(c));
684-
}
685-
ret outstr;
679+
map(s, char::to_lower)
686680
}
687681

688682
/*
689683
Function: to_upper
690684
691685
Convert a string to uppercase
692-
693-
FIXME: rewrite with map
694686
*/
695687
fn to_upper(s: str) -> str {
696-
let outstr = "";
697-
chars_iter(s) { |c|
698-
push_char(outstr, char::to_upper(c));
699-
}
700-
ret outstr;
688+
map(s, char::to_upper)
701689
}
702690

703691
// FIXME: This is super-inefficient
@@ -1583,8 +1571,9 @@ mod tests {
15831571

15841572
#[test]
15851573
fn test_to_upper() {
1586-
// to_upper doesn't understand unicode yet,
1587-
// but we need to at least preserve it
1574+
// char::to_upper, and hence str::to_upper
1575+
// are culturally insensitive: I'm not sure they
1576+
// really work for anything but English ASCII, but YMMV
15881577

15891578
let unicode = "\u65e5\u672c";
15901579
let input = "abcDEF" + unicode + "xyz:.;";
@@ -1593,6 +1582,12 @@ mod tests {
15931582
assert (eq(expected, actual));
15941583
}
15951584

1585+
#[test]
1586+
fn test_to_lower() {
1587+
assert "" == map("", char::to_lower);
1588+
assert "ymca" == map("YMCA", char::to_lower);
1589+
}
1590+
15961591
#[test]
15971592
fn test_slice() {
15981593
assert (eq("ab", slice("abc", 0u, 2u)));

0 commit comments

Comments
 (0)