]> git.lizzy.rs Git - rust.git/blobdiff - src/libterm/terminfo/parser/compiled.rs
Remove two useless comparisons
[rust.git] / src / libterm / terminfo / parser / compiled.rs
index e27f4652305ad0642c73cc5aa8f51dc091108198..db5dd2d5c1907375cc56b339837c1cbae86308db 100644 (file)
@@ -220,9 +220,7 @@ macro_rules! try( ($e:expr) => (
     if bools_bytes != 0 {
         for i in range(0, bools_bytes) {
             let b = try!(file.read_byte());
-            if b < 0 {
-                return Err("error: expected more bools but hit EOF".to_owned());
-            } else if b == 1 {
+            if b == 1 {
                 bools_map.insert(bnames[i as uint].to_owned(), true);
             }
         }
@@ -294,7 +292,12 @@ macro_rules! try( ($e:expr) => (
     }
 
     // And that's all there is to it
-    Ok(~TermInfo {names: term_names, bools: bools_map, numbers: numbers_map, strings: string_map })
+    Ok(box TermInfo {
+        names: term_names,
+        bools: bools_map,
+        numbers: numbers_map,
+        strings: string_map
+    })
 }
 
 /// Create a dummy TermInfo struct for msys terminals
@@ -304,7 +307,7 @@ pub fn msys_terminfo() -> ~TermInfo {
     strings.insert("bold".to_owned(), Vec::from_slice(bytes!("\x1b[1m")));
     strings.insert("setaf".to_owned(), Vec::from_slice(bytes!("\x1b[3%p1%dm")));
     strings.insert("setab".to_owned(), Vec::from_slice(bytes!("\x1b[4%p1%dm")));
-    ~TermInfo {
+    box TermInfo {
         names: vec!("cygwin".to_owned()), // msys is a fork of an older cygwin version
         bools: HashMap::new(),
         numbers: HashMap::new(),