Use mem::discriminant in impl PartialEq for CgroupError

This commit is contained in:
Hidehito Yabuuchi
2018-10-04 00:57:13 +09:00
committed by Levente Kurusa
parent 2149e1c0c4
commit ae56cb02b9

View File

@@ -92,38 +92,8 @@ pub enum CgroupError {
impl PartialEq for CgroupError {
fn eq(&self, other: &CgroupError) -> bool {
match self {
CgroupError::WriteError(_) => if let CgroupError::WriteError(_) = other {
return true;
} else {
return false;
},
CgroupError::ReadError(_) => if let CgroupError::ReadError(_) = other {
return true;
} else {
return false;
},
CgroupError::ParseError => if let CgroupError::ParseError = other {
return true;
} else {
return false;
},
CgroupError::InvalidOperation => if let CgroupError::InvalidOperation = other {
return true;
} else {
return false;
},
CgroupError::InvalidPath => if let CgroupError::InvalidPath = other {
return true;
} else {
return false;
},
CgroupError::Unknown => if let CgroupError::Unknown = other {
return true;
} else {
return false;
},
}
use std::mem::discriminant;
discriminant(&self) == discriminant(&other)
}
}