diff options
author | David Tolnay <dtolnay@chromium.org> | 2019-03-01 18:07:56 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-02 17:41:31 -0800 |
commit | c69f97542a6071f78d48a743ee94119a93bc9471 (patch) | |
tree | 69ee27de806bf460c108219d9d2c64bd633cf35d /gpu_buffer | |
parent | 5e1b46cbd8cb031a12c0fb20e94670f1007fd789 (diff) | |
download | crosvm-c69f97542a6071f78d48a743ee94119a93bc9471.tar crosvm-c69f97542a6071f78d48a743ee94119a93bc9471.tar.gz crosvm-c69f97542a6071f78d48a743ee94119a93bc9471.tar.bz2 crosvm-c69f97542a6071f78d48a743ee94119a93bc9471.tar.lz crosvm-c69f97542a6071f78d48a743ee94119a93bc9471.tar.xz crosvm-c69f97542a6071f78d48a743ee94119a93bc9471.tar.zst crosvm-c69f97542a6071f78d48a743ee94119a93bc9471.zip |
error: Consistently use Display instead of error description()
The description method is deprecated and its signature forces less helpful error messages than what Display can provide. BUG=none TEST=cargo check --all-features TEST=cargo check --target aarch64-unknown-linux-gnu Change-Id: I27fc99d59d0ef457c5273dc53e4c563ef439c2c0 Reviewed-on: https://chromium-review.googlesource.com/1497735 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'gpu_buffer')
-rw-r--r-- | gpu_buffer/src/lib.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gpu_buffer/src/lib.rs b/gpu_buffer/src/lib.rs index 112b086..ea77117 100644 --- a/gpu_buffer/src/lib.rs +++ b/gpu_buffer/src/lib.rs @@ -39,7 +39,7 @@ mod raw; pub mod rendernode; use std::cmp::min; -use std::fmt; +use std::fmt::{self, Display}; use std::fs::File; use std::isize; use std::os::raw::c_void; @@ -74,13 +74,15 @@ pub enum Error { Memcopy(VolatileMemoryError), } -impl fmt::Display for Error { +impl Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - Error::GbmFailed => write!(f, "internal GBM failure"), - Error::ExportFailed(e) => write!(f, "export failed: {}", e), - Error::MapFailed => write!(f, "map failed"), - Error::CheckedArithmetic { + use self::Error::*; + + match self { + GbmFailed => write!(f, "internal GBM failure"), + ExportFailed(e) => write!(f, "export failed: {}", e), + MapFailed => write!(f, "map failed"), + CheckedArithmetic { field1: (label1, value1), field2: (label2, value2), op, @@ -89,7 +91,7 @@ impl fmt::Display for Error { "arithmetic failed: {}({}) {} {}({})", label1, value1, op, label2, value2 ), - Error::InvalidPrecondition { + InvalidPrecondition { field1: (label1, value1), field2: (label2, value2), op, @@ -98,8 +100,8 @@ impl fmt::Display for Error { "invalid precondition: {}({}) {} {}({})", label1, value1, op, label2, value2 ), - Error::UnknownFormat(format) => write!(f, "unknown format {:?}", format), - Error::Memcopy(ref e) => write!(f, "error copying memory: {}", e), + UnknownFormat(format) => write!(f, "unknown format {:?}", format), + Memcopy(e) => write!(f, "error copying memory: {}", e), } } } |