Skip to content

Commit ded860c

Browse files
committed
libterm: Remove all uses of ~str from libterm
1 parent 93499b1 commit ded860c

File tree

5 files changed

+120
-93
lines changed

5 files changed

+120
-93
lines changed

src/libterm/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,12 @@ impl<T: Writer> Terminal<T> {
126126
/// Returns `Err()` on failure to open the terminfo database correctly.
127127
/// Also, in the event that the individual terminfo database entry can not
128128
/// be parsed.
129-
pub fn new(out: T) -> Result<Terminal<T>, ~str> {
129+
pub fn new(out: T) -> Result<Terminal<T>, StrBuf> {
130130
let term = match os::getenv("TERM") {
131131
Some(t) => t,
132-
None => return Err("TERM environment variable undefined".to_owned())
132+
None => {
133+
return Err("TERM environment variable undefined".to_strbuf())
134+
}
133135
};
134136

135137
let mut file = match open(term) {
@@ -251,7 +253,8 @@ impl<T: Writer> Terminal<T> {
251253
cap = self.ti.strings.find_equiv(&("op"));
252254
}
253255
}
254-
let s = cap.map_or(Err("can't find terminfo capability `sgr0`".to_owned()), |op| {
256+
let s = cap.map_or(Err("can't find terminfo capability \
257+
`sgr0`".to_strbuf()), |op| {
255258
expand(op.as_slice(), [], &mut Variables::new())
256259
});
257260
if s.is_ok() {

src/libterm/terminfo/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ use collections::HashMap;
1515
/// A parsed terminfo database entry.
1616
pub struct TermInfo {
1717
/// Names for the terminal
18-
pub names: Vec<~str> ,
18+
pub names: Vec<StrBuf> ,
1919
/// Map of capability name to boolean value
20-
pub bools: HashMap<~str, bool>,
20+
pub bools: HashMap<StrBuf, bool>,
2121
/// Map of capability name to numeric value
22-
pub numbers: HashMap<~str, u16>,
22+
pub numbers: HashMap<StrBuf, u16>,
2323
/// Map of capability name to raw (unexpanded) string
24-
pub strings: HashMap<~str, Vec<u8> >
24+
pub strings: HashMap<StrBuf, Vec<u8> >
2525
}
2626

2727
pub mod searcher;

0 commit comments

Comments
 (0)