File tree Expand file tree Collapse file tree 1 file changed +2
-32
lines changed Expand file tree Collapse file tree 1 file changed +2
-32
lines changed Original file line number Diff line number Diff line change @@ -92,38 +92,8 @@ pub enum CgroupError {
92
92
93
93
impl PartialEq for CgroupError {
94
94
fn eq ( & self , other : & CgroupError ) -> bool {
95
- match self {
96
- CgroupError :: WriteError ( _) => if let CgroupError :: WriteError ( _) = other {
97
- return true ;
98
- } else {
99
- return false ;
100
- } ,
101
- CgroupError :: ReadError ( _) => if let CgroupError :: ReadError ( _) = other {
102
- return true ;
103
- } else {
104
- return false ;
105
- } ,
106
- CgroupError :: ParseError => if let CgroupError :: ParseError = other {
107
- return true ;
108
- } else {
109
- return false ;
110
- } ,
111
- CgroupError :: InvalidOperation => if let CgroupError :: InvalidOperation = other {
112
- return true ;
113
- } else {
114
- return false ;
115
- } ,
116
- CgroupError :: InvalidPath => if let CgroupError :: InvalidPath = other {
117
- return true ;
118
- } else {
119
- return false ;
120
- } ,
121
- CgroupError :: Unknown => if let CgroupError :: Unknown = other {
122
- return true ;
123
- } else {
124
- return false ;
125
- } ,
126
- }
95
+ use std:: mem:: discriminant;
96
+ discriminant ( & self ) == discriminant ( & other)
127
97
}
128
98
}
129
99
You can’t perform that action at this time.
0 commit comments