about summary refs log tree commit diff
path: root/src/libterm/terminfo/parm.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-20 15:45:07 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-20 22:36:13 -0800
commit3cb9fa26ef9905c00a29ea577fb55a12a91c8e7b (patch)
treea1091c2dd4d5fc6d09be609ffc106295797a6e0a /src/libterm/terminfo/parm.rs
parent29bd9a06efd2f8c8a7b1102e2203cc0e6ae2dcba (diff)
downloadrust-3cb9fa26ef9905c00a29ea577fb55a12a91c8e7b.tar.gz
rust-3cb9fa26ef9905c00a29ea577fb55a12a91c8e7b.zip
std: Rename Show/String to Debug/Display
This commit is an implementation of [RFC 565][rfc] which is a stabilization of
the `std::fmt` module and the implementations of various formatting traits.
Specifically, the following changes were performed:

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md

* The `Show` trait is now deprecated, it was renamed to `Debug`
* The `String` trait is now deprecated, it was renamed to `Display`
* Many `Debug` and `Display` implementations were audited in accordance with the
  RFC and audited implementations now have the `#[stable]` attribute
  * Integers and floats no longer print a suffix
  * Smart pointers no longer print details that they are a smart pointer
  * Paths with `Debug` are now quoted and escape characters
* The `unwrap` methods on `Result` now require `Display` instead of `Debug`
* The `Error` trait no longer has a `detail` method and now requires that
  `Display` must be implemented. With the loss of `String`, this has moved into
  libcore.
* `impl<E: Error> FromError<E> for Box<Error>` now exists
* `derive(Show)` has been renamed to `derive(Debug)`. This is not currently
  warned about due to warnings being emitted on stage1+

While backwards compatibility is attempted to be maintained with a blanket
implementation of `Display` for the old `String` trait (and the same for
`Show`/`Debug`) this is still a breaking change due to primitives no longer
implementing `String` as well as modifications such as `unwrap` and the `Error`
trait. Most code is fairly straightforward to update with a rename or tweaks of
method calls.

[breaking-change]
Closes #21436
Diffstat (limited to 'src/libterm/terminfo/parm.rs')
-rw-r--r--src/libterm/terminfo/parm.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs
index b0bce8f3112..0b51a976c0e 100644
--- a/src/libterm/terminfo/parm.rs
+++ b/src/libterm/terminfo/parm.rs
@@ -624,7 +624,7 @@ mod test {
             };
             let res = get_res("%p1", cap, &[p], vars);
             assert!(res.is_ok(),
-                    "Op {} failed with 1 stack entry: {}", cap, res.unwrap_err());
+                    "Op {} failed with 1 stack entry: {}", cap, res.err().unwrap());
         }
         let caps = ["%+", "%-", "%*", "%/", "%m", "%&", "%|", "%A", "%O"];
         for &cap in caps.iter() {
@@ -636,7 +636,7 @@ mod test {
                     "Binop {} succeeded incorrectly with 1 stack entry", cap);
             let res = get_res("%{1}%{2}", cap, &[], vars);
             assert!(res.is_ok(),
-                    "Binop {} failed with 2 stack entries: {:?}", cap, res.unwrap_err());
+                    "Binop {} failed with 2 stack entries: {:?}", cap, res.err().unwrap());
         }
     }
 
@@ -651,15 +651,15 @@ mod test {
         for &(op, bs) in v.iter() {
             let s = format!("%{{1}}%{{2}}%{}%d", op);
             let res = expand(s.as_bytes(), &[], &mut Variables::new());
-            assert!(res.is_ok(), res.unwrap_err());
+            assert!(res.is_ok(), res.err().unwrap());
             assert_eq!(res.unwrap(), vec!(b'0' + bs[0]));
             let s = format!("%{{1}}%{{1}}%{}%d", op);
             let res = expand(s.as_bytes(), &[], &mut Variables::new());
-            assert!(res.is_ok(), res.unwrap_err());
+            assert!(res.is_ok(), res.err().unwrap());
             assert_eq!(res.unwrap(), vec!(b'0' + bs[1]));
             let s = format!("%{{2}}%{{1}}%{}%d", op);
             let res = expand(s.as_bytes(), &[], &mut Variables::new());
-            assert!(res.is_ok(), res.unwrap_err());
+            assert!(res.is_ok(), res.err().unwrap());
             assert_eq!(res.unwrap(), vec!(b'0' + bs[2]));
         }
     }
@@ -669,15 +669,15 @@ mod test {
         let mut vars = Variables::new();
         let s = b"\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m";
         let res = expand(s, &[Number(1)], &mut vars);
-        assert!(res.is_ok(), res.unwrap_err());
+        assert!(res.is_ok(), res.err().unwrap());
         assert_eq!(res.unwrap(),
                    "\\E[31m".bytes().collect::<Vec<_>>());
         let res = expand(s, &[Number(8)], &mut vars);
-        assert!(res.is_ok(), res.unwrap_err());
+        assert!(res.is_ok(), res.err().unwrap());
         assert_eq!(res.unwrap(),
                    "\\E[90m".bytes().collect::<Vec<_>>());
         let res = expand(s, &[Number(42)], &mut vars);
-        assert!(res.is_ok(), res.unwrap_err());
+        assert!(res.is_ok(), res.err().unwrap());
         assert_eq!(res.unwrap(),
                    "\\E[38;5;42m".bytes().collect::<Vec<_>>());
     }