diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-23 10:38:50 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-23 14:11:34 -0800 |
| commit | 08246520c0fef902b169233e26e15cf58ef1cd8b (patch) | |
| tree | 47aa2924eefd0a7fa9609fdf7c35cf83628a0ee8 /src/libcore | |
| parent | 86fbdbfbcd4c019fda26ff73b9e1e30ed7a8b174 (diff) | |
| download | rust-08246520c0fef902b169233e26e15cf58ef1cd8b.tar.gz rust-08246520c0fef902b169233e26e15cf58ef1cd8b.zip | |
std: Relax Result::unwrap() to Debug
This commit relaxes the bound on `Result::unwrap` and `Result::unwrap_err` from the `Display` trait to the `Debug` trait for generating an error message about the unwrapping operation. This commit is a breaking change and any breakage should be mitigated by ensuring that `Debug` is implemented on the relevant type. [breaking-change]
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/result.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs index c3d49e24978..118f29ccfa4 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -229,7 +229,7 @@ use self::Result::{Ok, Err}; use clone::Clone; -use fmt::Display; +use fmt::Debug; use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator, ExactSizeIterator}; use ops::{FnMut, FnOnce}; use option::Option::{self, None, Some}; @@ -714,7 +714,7 @@ impl<T, E> Result<T, E> { } #[stable] -impl<T, E: Display> Result<T, E> { +impl<T, E: Debug> Result<T, E> { /// Unwraps a result, yielding the content of an `Ok`. /// /// # Panics @@ -739,13 +739,13 @@ impl<T, E: Display> Result<T, E> { match self { Ok(t) => t, Err(e) => - panic!("called `Result::unwrap()` on an `Err` value: {}", e) + panic!("called `Result::unwrap()` on an `Err` value: {:?}", e) } } } #[stable] -impl<T: Display, E> Result<T, E> { +impl<T: Debug, E> Result<T, E> { /// Unwraps a result, yielding the content of an `Err`. /// /// # Panics @@ -769,7 +769,7 @@ impl<T: Display, E> Result<T, E> { pub fn unwrap_err(self) -> E { match self { Ok(t) => - panic!("called `Result::unwrap_err()` on an `Ok` value: {}", t), + panic!("called `Result::unwrap_err()` on an `Ok` value: {:?}", t), Err(e) => e } } |
