libterm: remove unnecessary as_slice() calls

This commit is contained in:
Jorge Aparicio 2014-11-27 15:03:37 -05:00
parent 39f44c0c20
commit 53b479c195
4 changed files with 4 additions and 6 deletions

View File

@ -183,7 +183,7 @@ impl<T: Writer+Send> TerminfoTerminal<T> {
let entry = open(term.as_slice()); let entry = open(term.as_slice());
if entry.is_err() { if entry.is_err() {
if os::getenv("MSYSCON").map_or(false, |s| { if os::getenv("MSYSCON").map_or(false, |s| {
"mintty.exe" == s.as_slice() "mintty.exe" == s
}) { }) {
// msys terminal // msys terminal
return Some(box TerminfoTerminal {out: out, return Some(box TerminfoTerminal {out: out,

View File

@ -529,8 +529,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> {
} }
} }
FormatHEX => { FormatHEX => {
s = s.as_slice() s = s.to_ascii()
.to_ascii()
.iter() .iter()
.map(|b| b.to_uppercase().as_byte()) .map(|b| b.to_uppercase().as_byte())
.collect(); .collect();

View File

@ -218,8 +218,7 @@ pub fn parse(file: &mut io::Reader, longnames: bool)
Err(_) => return Err("input not utf-8".to_string()), Err(_) => return Err("input not utf-8".to_string()),
}; };
let term_names: Vec<String> = names_str.as_slice() let term_names: Vec<String> = names_str.split('|')
.split('|')
.map(|s| s.to_string()) .map(|s| s.to_string())
.collect(); .collect();

View File

@ -37,7 +37,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<Box<Path>> {
dirs_to_search.push(homedir.unwrap().join(".terminfo")) dirs_to_search.push(homedir.unwrap().join(".terminfo"))
} }
match getenv("TERMINFO_DIRS") { match getenv("TERMINFO_DIRS") {
Some(dirs) => for i in dirs.as_slice().split(':') { Some(dirs) => for i in dirs.split(':') {
if i == "" { if i == "" {
dirs_to_search.push(Path::new("/usr/share/terminfo")); dirs_to_search.push(Path::new("/usr/share/terminfo"));
} else { } else {