File tree Expand file tree Collapse file tree 4 files changed +7
-11
lines changed Expand file tree Collapse file tree 4 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
- refs/heads/snap-stage3: 8c59d920a12fe40398a0033438ff426bb3387fd0
4
+ refs/heads/snap-stage3: ebefe425b962d3914cc523d7f539fdb2244cec06
5
5
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Original file line number Diff line number Diff line change @@ -143,8 +143,7 @@ fn try_parsing_version(s: &str) -> Option<Version> {
143
143
let s = s. trim ( ) ;
144
144
debug ! ( "Attempting to parse: %s" , s) ;
145
145
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| {
148
147
if char:: is_digit( c) {
149
148
parse_state = SawDigit ;
150
149
}
@@ -172,7 +171,7 @@ fn is_url_like(p: &RemotePath) -> bool {
172
171
/// Otherwise, return None.
173
172
pub fn split_version < ' a > ( s: & ' a str) -> Option < ( & ' a str , Version ) > {
174
173
// 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 {
176
175
return None ;
177
176
}
178
177
match s. rfind( '#' ) {
Original file line number Diff line number Diff line change @@ -432,11 +432,6 @@ pub fn byte_slice_no_callback<'a>(s: &'a str) -> &'a [u8] {
432
432
}
433
433
}
434
434
435
- /// Convert a string to a unique vector of characters
436
- pub fn to_chars ( s : & str ) -> ~[ char ] {
437
- s. iter ( ) . collect ( )
438
- }
439
-
440
435
/**
441
436
* Take a substring of another.
442
437
*
Original file line number Diff line number Diff line change 10
10
11
11
extern mod extra;
12
12
13
+ use std:: iterator:: IteratorUtil ;
13
14
use std:: str;
14
15
use std:: vec;
15
16
16
17
pub fn main ( ) {
17
18
// Chars of 1, 2, 3, and 4 bytes
18
19
let chs: ~[ char ] = ~[ 'e' , 'é' , '€' , 0x10000 as char ] ;
19
20
let s: ~str = str:: from_chars ( chs) ;
21
+ let schs: ~[ char ] = s. iter ( ) . collect ( ) ;
20
22
21
23
assert ! ( s. len( ) == 10 u) ;
22
24
assert ! ( str :: char_len( s) == 4 u) ;
23
- assert ! ( str :: to_chars ( s ) . len( ) == 4 u) ;
24
- assert ! ( str :: from_chars( str :: to_chars ( s ) ) == s) ;
25
+ assert ! ( schs . len( ) == 4 u) ;
26
+ assert ! ( str :: from_chars( schs ) == s) ;
25
27
assert ! ( s. char_at( 0 u) == 'e' ) ;
26
28
assert ! ( s. char_at( 1 u) == 'é' ) ;
27
29
You can’t perform that action at this time.
0 commit comments