Skip to content

Commit abe3fa1

Browse files
committed
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.
1 parent 5764634 commit abe3fa1

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/util/logger.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::sync::Arc;
2121
static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"];
2222

2323
/// An enum representing the available verbosity levels of the logger.
24-
#[derive(Copy, Clone, Eq, Debug, Hash)]
24+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
2525
pub enum Level {
2626
///Designates logger being silent
2727
Off,
@@ -37,13 +37,6 @@ pub enum Level {
3737
Trace,
3838
}
3939

40-
impl PartialEq for Level {
41-
#[inline]
42-
fn eq(&self, other: &Level) -> bool {
43-
*self as usize == *other as usize
44-
}
45-
}
46-
4740
impl PartialOrd for Level {
4841
#[inline]
4942
fn partial_cmp(&self, other: &Level) -> Option<cmp::Ordering> {

0 commit comments

Comments
 (0)