diff options
| author | klutzy <klutzytheklutzy@gmail.com> | 2013-12-08 16:12:07 +0900 |
|---|---|---|
| committer | klutzy <klutzytheklutzy@gmail.com> | 2013-12-11 15:50:51 +0900 |
| commit | 5a93d12e01c8275674bcdb6f3f765a7bdcf08779 (patch) | |
| tree | 32866c4cc1b0bdcd81e23dad666a51e34c94d8d4 /src/compiletest | |
| parent | b8b16ae0996074861693f0f76d5d937fafe6a37e (diff) | |
std::io: Add Buffer.lines(), change .bytes() api
- `Buffer.lines()` returns `LineIterator` which yields line using
`.read_line()`.
- `Reader.bytes()` now takes `&mut self` instead of `self`.
- `Reader.read_until()` swallows `EndOfFile`. This also affects
`.read_line()`.
Diffstat (limited to 'src/compiletest')
| -rw-r--r-- | src/compiletest/errors.rs | 5 | ||||
| -rw-r--r-- | src/compiletest/header.rs | 6 |
2 files changed, 2 insertions, 9 deletions
diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index 6be92b12535..b15bf73c193 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -19,10 +19,7 @@ pub fn load_errors(testfile: &Path) -> ~[ExpectedError] { let mut error_patterns = ~[]; let mut rdr = BufferedReader::new(File::open(testfile).unwrap()); let mut line_num = 1u; - loop { - let ln = match rdr.read_line() { - Some(ln) => ln, None => break, - }; + for ln in rdr.lines() { error_patterns.push_all_move(parse_expected(line_num, ln)); line_num += 1u; } diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 1966701dbde..98989a2cba2 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -107,11 +107,7 @@ fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool { use std::io::File; let mut rdr = BufferedReader::new(File::open(testfile).unwrap()); - loop { - let ln = match rdr.read_line() { - Some(ln) => ln, None => break - }; - + for ln in rdr.lines() { // Assume that any directives will be found before the first // module or function. This doesn't seem to be an optimization // with a warm page cache. Maybe with a cold one. |
