diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-09 23:10:50 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-10 23:02:54 +1000 |
| commit | 1e8982bdb26208d9d9ed4cdcbcd21cc9ef35bd46 (patch) | |
| tree | 54f03a318e14bcdbdb56e01b3c80d00a9db87a17 /src/libextra/terminfo/parser | |
| parent | 2ff6b298c5f23f48aa993fced41b6e29e446b7ce (diff) | |
| download | rust-1e8982bdb26208d9d9ed4cdcbcd21cc9ef35bd46.tar.gz rust-1e8982bdb26208d9d9ed4cdcbcd21cc9ef35bd46.zip | |
std: replace str::each_split* with an iterator
Diffstat (limited to 'src/libextra/terminfo/parser')
| -rw-r--r-- | src/libextra/terminfo/parser/compiled.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index 61c68c27fe5..690596e6248 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -14,6 +14,7 @@ use core::prelude::*; use core::{vec, int, str}; use core::io::Reader; +use core::iterator::IteratorUtil; use core::hashmap::HashMap; use super::super::TermInfo; @@ -212,11 +213,8 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { return Err(~"incompatible file: more string offsets than expected"); } - let mut term_names: ~[~str] = vec::with_capacity(2); let names_str = str::from_bytes(file.read_bytes(names_bytes as uint - 1)); // don't read NUL - for names_str.each_split_char('|') |s| { - term_names.push(s.to_owned()); - } + let term_names: ~[~str] = names_str.split_iter('|').transform(|s| s.to_owned()).collect(); file.read_byte(); // consume NUL |
