diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-09-17 12:56:31 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-09-21 22:15:51 -0700 |
| commit | 0169218047dc989acf9ea25e3122b9c659acb6b3 (patch) | |
| tree | 8b1cd720a9e38c745359581e74d216a04e39e5ef /src/libterm | |
| parent | 087b9283a0ed8df68f47ab07a25e60bc6a3ca050 (diff) | |
Fix fallout from Vec stabilization
Diffstat (limited to 'src/libterm')
| -rw-r--r-- | src/libterm/terminfo/parm.rs | 16 | ||||
| -rw-r--r-- | src/libterm/terminfo/parser/compiled.rs | 13 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 93f773f430d..3f626d716f8 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -505,8 +505,8 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> { if flags.precision > s.len() { let mut s_ = Vec::with_capacity(flags.precision); let n = flags.precision - s.len(); - s_.grow(n, &b'0'); - s_.push_all_move(s); + s_.grow(n, b'0'); + s_.extend(s.into_iter()); s = s_; } assert!(!s.is_empty(), "string conversion produced empty result"); @@ -524,7 +524,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> { FormatHex => { if flags.alternate { let s_ = replace(&mut s, vec!(b'0', b'x')); - s.push_all_move(s_); + s.extend(s_.into_iter()); } } FormatHEX => { @@ -536,7 +536,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> { .collect(); if flags.alternate { let s_ = replace(&mut s, vec!(b'0', b'X')); - s.push_all_move(s_); + s.extend(s_.into_iter()); } } FormatString => unreachable!() @@ -546,7 +546,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> { Words(s) => { match op { FormatString => { - let mut s = Vec::from_slice(s.as_bytes()); + let mut s = s.as_bytes().to_vec(); if flags.precision > 0 && flags.precision < s.len() { s.truncate(flags.precision); } @@ -562,11 +562,11 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> { if flags.width > s.len() { let n = flags.width - s.len(); if flags.left { - s.grow(n, &b' '); + s.grow(n, b' '); } else { let mut s_ = Vec::with_capacity(flags.width); - s_.grow(n, &b' '); - s_.push_all_move(s); + s_.grow(n, b' '); + s_.extend(s.into_iter()); s = s_; } } diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 2826ecc1a12..f59a4465e1d 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -290,9 +290,8 @@ pub fn parse(file: &mut io::Reader, longnames: bool) match nulpos { Some(len) => { string_map.insert(name.to_string(), - Vec::from_slice( - string_table.slice(offset as uint, - offset as uint + len))) + string_table.slice(offset as uint, + offset as uint + len).to_vec()) }, None => { return Err("invalid file: missing NUL in \ @@ -314,10 +313,10 @@ pub fn parse(file: &mut io::Reader, longnames: bool) /// Create a dummy TermInfo struct for msys terminals pub fn msys_terminfo() -> Box<TermInfo> { let mut strings = HashMap::new(); - strings.insert("sgr0".to_string(), Vec::from_slice(b"\x1B[0m")); - strings.insert("bold".to_string(), Vec::from_slice(b"\x1B[1m")); - strings.insert("setaf".to_string(), Vec::from_slice(b"\x1B[3%p1%dm")); - strings.insert("setab".to_string(), Vec::from_slice(b"\x1B[4%p1%dm")); + strings.insert("sgr0".to_string(), b"\x1B[0m".to_vec()); + strings.insert("bold".to_string(), b"\x1B[1m".to_vec()); + strings.insert("setaf".to_string(), b"\x1B[3%p1%dm".to_vec()); + strings.insert("setab".to_string(), b"\x1B[4%p1%dm".to_vec()); box TermInfo { names: vec!("cygwin".to_string()), // msys is a fork of an older cygwin version bools: HashMap::new(), |
