From d0e60b72ee3f5fb07b01143d82362cb42307f32d Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 26 Mar 2014 09:24:16 -0700 Subject: De-~[] Reader and Writer There's a little more allocation here and there now since from_utf8_owned can't be used with Vec. --- src/libterm/terminfo/parser/compiled.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libterm') diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 6d87d91ffc0..37ef3c133a5 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -208,8 +208,8 @@ pub fn parse(file: &mut io::Reader, // don't read NUL let bytes = try!(file.read_exact(names_bytes as uint - 1)); - let names_str = match str::from_utf8_owned(bytes) { - Some(s) => s, None => return Err(~"input not utf-8"), + let names_str = match str::from_utf8(bytes.as_slice()) { + Some(s) => s.to_owned(), None => return Err(~"input not utf-8"), }; let term_names: Vec<~str> = names_str.split('|').map(|s| s.to_owned()).collect(); -- cgit 1.4.1-3-g733a5