Skip to content

Commit 675b9ce

Browse files
committed
---
yaml --- r: 54172 b: refs/heads/dist-snap c: 3ba7e04 h: refs/heads/master v: v3
1 parent 2fa663f commit 675b9ce

File tree

29 files changed

+463
-465
lines changed

29 files changed

+463
-465
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 3d588c528685fa0590ff91f189f0ef44a3815ec2
10+
refs/heads/dist-snap: 3ba7e041f10f1e955120c33f5aab0817e02c5222
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/compiletest/header.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ fn parse_check_line(line: ~str) -> Option<~str> {
142142
fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
143143
do parse_name_value_directive(line, ~"exec-env").map |nv| {
144144
// nv is either FOO or FOO=BAR
145-
let mut strs = ~[];
146-
for str::each_splitn_char(*nv, '=', 1u) |s| { strs.push(s.to_owned()); }
145+
let strs = str::splitn_char(*nv, '=', 1u);
147146
match strs.len() {
148147
1u => (strs[0], ~""),
149148
2u => (strs[0], strs[1]),

branches/dist-snap/src/compiletest/runtest.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
267267
// check if each line in props.check_lines appears in the
268268
// output (in order)
269269
let mut i = 0u;
270-
for str::each_line(ProcRes.stdout) |line| {
270+
for str::lines_each(ProcRes.stdout) |line| {
271271
if props.check_lines[i].trim() == line.trim() {
272272
i += 1u;
273273
}
@@ -297,7 +297,7 @@ fn check_error_patterns(props: TestProps,
297297
let mut next_err_idx = 0u;
298298
let mut next_err_pat = props.error_patterns[next_err_idx];
299299
let mut done = false;
300-
for str::each_line(ProcRes.stderr) |line| {
300+
for str::lines_each(ProcRes.stderr) |line| {
301301
if str::contains(line, next_err_pat) {
302302
debug!("found error pattern %s", next_err_pat);
303303
next_err_idx += 1u;
@@ -347,7 +347,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
347347
// filename:line1:col1: line2:col2: *warning:* msg
348348
// where line1:col1: is the starting point, line2:col2:
349349
// is the ending point, and * represents ANSI color codes.
350-
for str::each_line(ProcRes.stderr) |line| {
350+
for str::lines_each(ProcRes.stderr) |line| {
351351
let mut was_expected = false;
352352
for vec::eachi(expected_errors) |i, ee| {
353353
if !found_flags[i] {
@@ -596,12 +596,8 @@ fn split_maybe_args(argstr: Option<~str>) -> ~[~str] {
596596
}
597597

598598
match argstr {
599-
Some(s) => {
600-
let mut ss = ~[];
601-
for str::each_split_char(s, ' ') |s| { ss.push(s.to_owned()) }
602-
rm_whitespace(ss)
603-
}
604-
None => ~[]
599+
Some(s) => rm_whitespace(str::split_char(s, ' ')),
600+
None => ~[]
605601
}
606602
}
607603

branches/dist-snap/src/libcore/num/strconv.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ impl_NumStrConv_Integer!(u16)
130130
impl_NumStrConv_Integer!(u32)
131131
impl_NumStrConv_Integer!(u64)
132132

133-
134-
// Special value strings as [u8] consts.
135-
static inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8];
136-
static positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
137-
static negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
138-
static nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8];
139-
140133
/**
141134
* Converts a number to its string representation as a byte vector.
142135
* This is meant to be a common base implementation for all numeric string
@@ -486,15 +479,15 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Ord+Copy+Div<T,T>+
486479
}
487480

488481
if special {
489-
if buf == inf_buf || buf == positive_inf_buf {
482+
if buf == str::inf_buf || buf == str::positive_inf_buf {
490483
return NumStrConv::inf();
491-
} else if buf == negative_inf_buf {
484+
} else if buf == str::negative_inf_buf {
492485
if negative {
493486
return NumStrConv::neg_inf();
494487
} else {
495488
return None;
496489
}
497-
} else if buf == nan_buf {
490+
} else if buf == str::nan_buf {
498491
return NumStrConv::NaN();
499492
}
500493
}

branches/dist-snap/src/libcore/os.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ pub fn env() -> ~[(~str,~str)] {
218218
fn env_convert(input: ~[~str]) -> ~[(~str, ~str)] {
219219
let mut pairs = ~[];
220220
for input.each |p| {
221-
let mut vs = ~[];
222-
for str::each_splitn_char(*p, '=', 1) |s| { vs.push(s.to_owned()) }
221+
let vs = str::splitn_char(*p, '=', 1);
223222
debug!("splitting: len: %u",
224223
vs.len());
225224
fail_unless!(vs.len() == 2);

branches/dist-snap/src/libcore/path.rs

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ impl ToStr for PosixPath {
381381
impl GenericPath for PosixPath {
382382

383383
fn from_str(s: &str) -> PosixPath {
384-
let mut components = ~[];
385-
for str::each_split_nonempty(s, |c| c == '/') |s| { components.push(s.to_owned()) }
384+
let mut components = str::split_nonempty(s, |c| c == '/');
386385
let is_absolute = (s.len() != 0 && s[0] == '/' as u8);
387386
return PosixPath { is_absolute: is_absolute,
388387
components: components }
@@ -505,10 +504,9 @@ impl GenericPath for PosixPath {
505504
fn push_many(&self, cs: &[~str]) -> PosixPath {
506505
let mut v = copy self.components;
507506
for cs.each |e| {
508-
let mut ss = ~[];
509-
for str::each_split_nonempty(*e, |c| windows::is_sep(c as u8)) |s| {
510-
ss.push(s.to_owned())
511-
}
507+
let mut ss = str::split_nonempty(
508+
*e,
509+
|c| windows::is_sep(c as u8));
512510
unsafe { v.push_all_move(ss); }
513511
}
514512
PosixPath { is_absolute: self.is_absolute,
@@ -517,10 +515,7 @@ impl GenericPath for PosixPath {
517515

518516
fn push(&self, s: &str) -> PosixPath {
519517
let mut v = copy self.components;
520-
let mut ss = ~[];
521-
for str::each_split_nonempty(s, |c| windows::is_sep(c as u8)) |s| {
522-
ss.push(s.to_owned())
523-
}
518+
let mut ss = str::split_nonempty(s, |c| windows::is_sep(c as u8));
524519
unsafe { v.push_all_move(ss); }
525520
PosixPath { components: v, ..copy *self }
526521
}
@@ -595,10 +590,8 @@ impl GenericPath for WindowsPath {
595590
}
596591
}
597592

598-
let mut components = ~[];
599-
for str::each_split_nonempty(rest, |c| windows::is_sep(c as u8)) |s| {
600-
components.push(s.to_owned())
601-
}
593+
let mut components =
594+
str::split_nonempty(rest, |c| windows::is_sep(c as u8));
602595
let is_absolute = (rest.len() != 0 && windows::is_sep(rest[0]));
603596
return WindowsPath { host: host,
604597
device: device,
@@ -766,10 +759,9 @@ impl GenericPath for WindowsPath {
766759
fn push_many(&self, cs: &[~str]) -> WindowsPath {
767760
let mut v = copy self.components;
768761
for cs.each |e| {
769-
let mut ss = ~[];
770-
for str::each_split_nonempty(*e, |c| windows::is_sep(c as u8)) |s| {
771-
ss.push(s.to_owned())
772-
}
762+
let mut ss = str::split_nonempty(
763+
*e,
764+
|c| windows::is_sep(c as u8));
773765
unsafe { v.push_all_move(ss); }
774766
}
775767
// tedious, but as-is, we can't use ..self
@@ -783,10 +775,7 @@ impl GenericPath for WindowsPath {
783775

784776
fn push(&self, s: &str) -> WindowsPath {
785777
let mut v = copy self.components;
786-
let mut ss = ~[];
787-
for str::each_split_nonempty(s, |c| windows::is_sep(c as u8)) |s| {
788-
ss.push(s.to_owned())
789-
}
778+
let mut ss = str::split_nonempty(s, |c| windows::is_sep(c as u8));
790779
unsafe { v.push_all_move(ss); }
791780
return WindowsPath { components: v, ..copy *self }
792781
}

branches/dist-snap/src/libcore/rand.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ impl RngUtil for @Rng {
327327
*/
328328
fn gen_char_from(&self, chars: &str) -> char {
329329
fail_unless!(!chars.is_empty());
330-
let mut cs = ~[];
331-
for str::each_char(chars) |c| { cs.push(c) }
332-
self.choose(cs)
330+
self.choose(str::chars(chars))
333331
}
334332

335333
/// Return a random bool

branches/dist-snap/src/libcore/repr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ impl TyVisitor for ReprVisitor {
451451
}
452452
fn visit_leave_tup(&self, _n_fields: uint,
453453
_sz: uint, _align: uint) -> bool {
454+
if _n_fields == 1 {
455+
self.writer.write_char(',');
456+
}
454457
self.writer.write_char(')');
455458
true
456459
}
@@ -591,7 +594,6 @@ fn test_repr() {
591594
fail_unless!(s == e);
592595
}
593596

594-
595597
exact_test(&10, "10");
596598
exact_test(&true, "true");
597599
exact_test(&false, "false");
@@ -608,6 +610,7 @@ fn test_repr() {
608610
let mut x = 10;
609611
exact_test(&(&mut x), "&mut 10");
610612

613+
exact_test(&(1,), "(1,)");
611614
exact_test(&(@[1,2,3,4,5,6,7,8]),
612615
"@[1, 2, 3, 4, 5, 6, 7, 8]");
613616
exact_test(&(@[1u8,2u8,3u8,4u8]),

0 commit comments

Comments
 (0)