From 70628261ebf7ed9118a2b00828c5b9107754d07d Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sun, 18 Feb 2018 21:03:45 -0800 Subject: 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. --- nitrocli/src/error.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'nitrocli/src/error.rs') 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 for Error { fn from(e: libhid::Error) -> Error { - return Error::HidError(e); + Error::HidError(e) } } impl From for Error { fn from(e: io::Error) -> Error { - return Error::IoError(e); + Error::IoError(e) } } impl From 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), } } } -- cgit v1.2.1