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 /data_model | |
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 'data_model')
-rw-r--r-- | data_model/src/volatile_memory.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/data_model/src/volatile_memory.rs b/data_model/src/volatile_memory.rs index 450d92e..5a2c80a 100644 --- a/data_model/src/volatile_memory.rs +++ b/data_model/src/volatile_memory.rs @@ -20,7 +20,7 @@ //! not reordered or elided the access. use std::cmp::min; -use std::fmt; +use std::fmt::{self, Display}; use std::io::Result as IoResult; use std::io::{Read, Write}; use std::marker::PhantomData; @@ -41,13 +41,13 @@ pub enum VolatileMemoryError { Overflow { base: u64, offset: u64 }, } -impl fmt::Display for VolatileMemoryError { +impl Display for VolatileMemoryError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use self::VolatileMemoryError::*; + match self { - VolatileMemoryError::OutOfBounds { addr } => { - write!(f, "address 0x{:x} is out of bounds", addr) - } - VolatileMemoryError::Overflow { base, offset } => write!( + OutOfBounds { addr } => write!(f, "address 0x{:x} is out of bounds", addr), + Overflow { base, offset } => write!( f, "address 0x{:x} offset by 0x{:x} would overflow", base, offset |