From: Carl Dong Date: Thu, 7 Feb 2019 18:08:21 +0000 (-0500) Subject: util: Derive PartialEq for Level X-Git-Tag: v0.0.12~227^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=abe3fa1a40533162f653ad465290d5875edac1d4;p=rust-lightning util: Derive PartialEq for Level PartialEq, Eq, and Hash should all be derived together wherever possible to not violate Hash invariants. See the documentation for std::hash::Hash for more details. --- diff --git a/src/util/logger.rs b/src/util/logger.rs index 82b8e3ea..e727723c 100644 --- a/src/util/logger.rs +++ b/src/util/logger.rs @@ -21,7 +21,7 @@ use std::sync::Arc; static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"]; /// An enum representing the available verbosity levels of the logger. -#[derive(Copy, Clone, Eq, Debug, Hash)] +#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] pub enum Level { ///Designates logger being silent Off, @@ -37,13 +37,6 @@ pub enum Level { Trace, } -impl PartialEq for Level { - #[inline] - fn eq(&self, other: &Level) -> bool { - *self as usize == *other as usize - } -} - impl PartialOrd for Level { #[inline] fn partial_cmp(&self, other: &Level) -> Option {