diff options
author | Sam Scott <sam.scott89@gmail.com> | 2019-01-23 11:14:57 -0500 |
---|---|---|
committer | Sam Scott <sam.scott89@gmail.com> | 2019-01-23 11:14:57 -0500 |
commit | f27c161dafca1ffae86e104eea4fad8c899f0f21 (patch) | |
tree | d7a406d097833fc1821d8cf28835cc90e91e42be /src/error.rs | |
parent | b69c42eb9b9f055e74353c9c149074616eff181f (diff) |
Run cargo fmt.
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/error.rs b/src/error.rs index 596f0a7..360d2b3 100644 --- a/src/error.rs +++ b/src/error.rs @@ -10,7 +10,7 @@ use std::str; use std::string; error_chain! { - errors { + errors { Custom(msg: String) { description("miscellaneous failure") display("failed with reason: {}", msg) @@ -34,16 +34,18 @@ error_chain! { impl Error { /// Generate error to show top-level type cannot be deserialized. pub fn top_level(object: &'static str) -> Self { - ErrorKind::Custom(format!("cannot deserialize {} at the top level.\ - Try deserializing into a struct.", - object)) - .into() - + ErrorKind::Custom(format!( + "cannot deserialize {} at the top level.\ + Try deserializing into a struct.", + object + )) + .into() } /// Generate a parsing error message with position. pub fn parse_err<T>(msg: T, position: usize) -> Self - where T: Display, + where + T: Display, { ErrorKind::Parse(msg.to_string(), position).into() } @@ -51,7 +53,8 @@ impl Error { impl de::Error for Error { fn custom<T>(msg: T) -> Self - where T: Display, + where + T: Display, { ErrorKind::Custom(msg.to_string()).into() } |