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());
if entry.is_err() {
if os::getenv("MSYSCON").map_or(false, |s| {
"mintty.exe" == s.as_slice()
"mintty.exe" == s
}) {
// msys terminal
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 => {
s = s.as_slice()
.to_ascii()
s = s.to_ascii()
.iter()
.map(|b| b.to_uppercase().as_byte())
.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()),
};
let term_names: Vec<String> = names_str.as_slice()
.split('|')
let term_names: Vec<String> = names_str.split('|')
.map(|s| s.to_string())
.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"))
}
match getenv("TERMINFO_DIRS") {
Some(dirs) => for i in dirs.as_slice().split(':') {
Some(dirs) => for i in dirs.split(':') {
if i == "" {
dirs_to_search.push(Path::new("/usr/share/terminfo"));
} else {