mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
Use mem::discriminant in impl PartialEq for CgroupError
This commit is contained in:
committed by
Levente Kurusa
parent
2149e1c0c4
commit
ae56cb02b9
34
src/lib.rs
34
src/lib.rs
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user