Skip to content

Commit bf4f186

Browse files
committed
---
yaml --- r: 63171 b: refs/heads/snap-stage3 c: ebefe42 h: refs/heads/master i: 63169: 1f2f9fa 63167: d53b7b8 v: v3
1 parent c339314 commit bf4f186

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 8c59d920a12fe40398a0033438ff426bb3387fd0
4+
refs/heads/snap-stage3: ebefe425b962d3914cc523d7f539fdb2244cec06
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustpkg/version.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ fn try_parsing_version(s: &str) -> Option<Version> {
143143
let s = s.trim();
144144
debug!("Attempting to parse: %s", s);
145145
let mut parse_state = Start;
146-
// I gave up on using external iterators (tjc)
147-
for str::to_chars(s).each() |&c| {
146+
for s.iter().advance |&c| {
148147
if char::is_digit(c) {
149148
parse_state = SawDigit;
150149
}
@@ -172,7 +171,7 @@ fn is_url_like(p: &RemotePath) -> bool {
172171
/// Otherwise, return None.
173172
pub fn split_version<'a>(s: &'a str) -> Option<(&'a str, Version)> {
174173
// reject strings with multiple '#'s
175-
if { let mut i: uint = 0; for str::to_chars(s).each |&c| { if c == '#' { i += 1; } }; i > 1 } {
174+
if s.splitn_iter('#', 2).count() > 1 {
176175
return None;
177176
}
178177
match s.rfind('#') {

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,6 @@ pub fn byte_slice_no_callback<'a>(s: &'a str) -> &'a [u8] {
432432
}
433433
}
434434

435-
/// Convert a string to a unique vector of characters
436-
pub fn to_chars(s: &str) -> ~[char] {
437-
s.iter().collect()
438-
}
439-
440435
/**
441436
* Take a substring of another.
442437
*

branches/snap-stage3/src/test/run-pass/utf8_chars.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@
1010

1111
extern mod extra;
1212

13+
use std::iterator::IteratorUtil;
1314
use std::str;
1415
use std::vec;
1516

1617
pub fn main() {
1718
// Chars of 1, 2, 3, and 4 bytes
1819
let chs: ~[char] = ~['e', 'é', '€', 0x10000 as char];
1920
let s: ~str = str::from_chars(chs);
21+
let schs: ~[char] = s.iter().collect();
2022

2123
assert!(s.len() == 10u);
2224
assert!(str::char_len(s) == 4u);
23-
assert!(str::to_chars(s).len() == 4u);
24-
assert!(str::from_chars(str::to_chars(s)) == s);
25+
assert!(schs.len() == 4u);
26+
assert!(str::from_chars(schs) == s);
2527
assert!(s.char_at(0u) == 'e');
2628
assert!(s.char_at(1u) == 'é');
2729

0 commit comments

Comments
 (0)