@@ -11,7 +11,7 @@ use std::string::String;
11
11
use std:: { collections:: HashMap , str:: FromStr } ;
12
12
use tracing:: { info, warn} ;
13
13
14
- #[ derive( Serialize , Deserialize , Debug , PartialEq ) ]
14
+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq ) ]
15
15
#[ serde( rename_all = "camelCase" ) ]
16
16
pub enum Serve {
17
17
Select ( usize ) ,
@@ -52,10 +52,10 @@ impl Serve {
52
52
}
53
53
}
54
54
55
- #[ derive( Serialize , Deserialize , Debug , PartialEq ) ]
55
+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq ) ]
56
56
struct BucketRange ( ( u32 , u32 ) ) ;
57
57
58
- #[ derive( Serialize , Deserialize , Debug , PartialEq ) ]
58
+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq ) ]
59
59
#[ serde( rename_all = "camelCase" ) ]
60
60
pub struct Distribution {
61
61
distribution : Vec < Vec < BucketRange > > ,
@@ -130,7 +130,7 @@ pub struct EvalParams<'a> {
130
130
segment_repo : & ' a HashMap < String , Segment > ,
131
131
}
132
132
133
- #[ derive( Serialize , Deserialize , Debug , PartialEq , Default ) ]
133
+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq , Default ) ]
134
134
#[ serde( rename_all = "camelCase" ) ]
135
135
pub struct EvalDetail < T > {
136
136
pub value : Option < T > ,
@@ -140,7 +140,7 @@ pub struct EvalDetail<T> {
140
140
pub reason : String ,
141
141
}
142
142
143
- #[ derive( Serialize , Deserialize , Debug , PartialEq ) ]
143
+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq ) ]
144
144
#[ serde( rename_all = "camelCase" ) ]
145
145
pub struct Toggle {
146
146
key : String ,
@@ -296,7 +296,7 @@ struct DefaultRule {
296
296
pub serve : Serve ,
297
297
}
298
298
299
- #[ derive( Serialize , Deserialize , Debug , PartialEq ) ]
299
+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq ) ]
300
300
struct Rule {
301
301
serve : Serve ,
302
302
conditions : Vec < Condition > ,
@@ -317,7 +317,7 @@ impl Rule {
317
317
}
318
318
}
319
319
320
- #[ derive( Serialize , Deserialize , Debug , PartialEq , Clone ) ]
320
+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq , Clone ) ]
321
321
#[ serde( rename_all = "camelCase" ) ]
322
322
enum ConditionType {
323
323
String ,
@@ -329,7 +329,7 @@ enum ConditionType {
329
329
Unknown ,
330
330
}
331
331
332
- #[ derive( Serialize , Deserialize , Debug , PartialEq , Clone ) ]
332
+ #[ derive( Serialize , Deserialize , Debug , PartialEq , Eq , Clone ) ]
333
333
struct Condition {
334
334
r#type : ConditionType ,
335
335
#[ serde( default ) ]
@@ -425,14 +425,14 @@ impl Condition {
425
425
} ,
426
426
None => unix_timestamp ( ) / 1000 ,
427
427
} ;
428
- return match predicate {
428
+ match predicate {
429
429
"after" => self . do_match :: < u128 > ( & c, |c, o| c. ge ( o) ) ,
430
430
"before" => self . do_match :: < u128 > ( & c, |c, o| c. lt ( o) ) ,
431
431
_ => {
432
432
info ! ( "unknown predicate {}" , predicate) ;
433
433
false
434
434
}
435
- } ;
435
+ }
436
436
}
437
437
438
438
fn do_match < T : FromStr > ( & self , t : & T , f : fn ( & T , & T ) -> bool ) -> bool {
0 commit comments