aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/error.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2018-02-18 21:03:45 -0800
committerDaniel Mueller <deso@posteo.net>2018-02-18 21:03:45 -0800
commit70628261ebf7ed9118a2b00828c5b9107754d07d (patch)
tree55caccfa4d4145dcfa1446436b9ddf42cd1fd8d2 /nitrocli/src/error.rs
parentb0001200996e32d765c8f428aff418b54c9ab7b0 (diff)
downloadnitrocli-70628261ebf7ed9118a2b00828c5b9107754d07d.tar.gz
nitrocli-70628261ebf7ed9118a2b00828c5b9107754d07d.tar.bz2
Fix issues reported by clippy
The clippy tool has a couple of suggestions on how to improve the code. This change applies them to the project's code base.
Diffstat (limited to 'nitrocli/src/error.rs')
-rw-r--r--nitrocli/src/error.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/nitrocli/src/error.rs b/nitrocli/src/error.rs
index a88b5a7..ea9a189 100644
--- a/nitrocli/src/error.rs
+++ b/nitrocli/src/error.rs
@@ -1,7 +1,7 @@
// error.rs
// *************************************************************************
-// * Copyright (C) 2017 Daniel Mueller (deso@posteo.net) *
+// * Copyright (C) 2017-2018 Daniel Mueller (deso@posteo.net) *
// * *
// * This program is free software: you can redistribute it and/or modify *
// * it under the terms of the GNU General Public License as published by *
@@ -34,32 +34,32 @@ pub enum Error {
impl From<libhid::Error> for Error {
fn from(e: libhid::Error) -> Error {
- return Error::HidError(e);
+ Error::HidError(e)
}
}
impl From<io::Error> for Error {
fn from(e: io::Error) -> Error {
- return Error::IoError(e);
+ Error::IoError(e)
}
}
impl From<string::FromUtf8Error> for Error {
fn from(e: string::FromUtf8Error) -> Error {
- return Error::Utf8Error(e);
+ Error::Utf8Error(e)
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match *&self {
- &Error::HidError(ref e) => return write!(f, "hidapi error: {}", e),
- &Error::Utf8Error(_) => return write!(f, "Encountered UTF-8 conversion error"),
- &Error::IoError(ref e) => return write!(f, "IO error: {}", e.get_ref().unwrap()),
- &Error::Error(ref e) => return write!(f, "{}", e),
+ match *self {
+ Error::HidError(ref e) => write!(f, "hidapi error: {}", e),
+ Error::Utf8Error(_) => write!(f, "Encountered UTF-8 conversion error"),
+ Error::IoError(ref e) => write!(f, "IO error: {}", e.get_ref().unwrap()),
+ Error::Error(ref e) => write!(f, "{}", e),
}
}
}