File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,8 @@ impl PartialEq for Map<String, Value> {
233
233
}
234
234
}
235
235
236
+ impl Eq for Map < String , Value > { }
237
+
236
238
/// Access an element of this map. Panics if the given key is not present in the
237
239
/// map.
238
240
///
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ use serde::de::{IntoDeserializer, MapAccess};
16
16
pub ( crate ) const TOKEN : & str = "$serde_json::private::Number" ;
17
17
18
18
/// Represents a JSON number, whether integer or floating point.
19
- #[ derive( Clone , PartialEq ) ]
19
+ #[ derive( Clone , Eq , PartialEq ) ]
20
20
pub struct Number {
21
21
n : N ,
22
22
}
@@ -31,6 +31,10 @@ enum N {
31
31
Float ( f64 ) ,
32
32
}
33
33
34
+ // Implementing Eq is fine since any float values are always finite.
35
+ #[ cfg( not( feature = "arbitrary_precision" ) ) ]
36
+ impl Eq for N { }
37
+
34
38
#[ cfg( feature = "arbitrary_precision" ) ]
35
39
type N = String ;
36
40
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ pub use crate::raw::RawValue;
107
107
/// Represents any valid JSON value.
108
108
///
109
109
/// See the `serde_json::value` module documentation for usage examples.
110
- #[ derive( Clone , PartialEq ) ]
110
+ #[ derive( Clone , Eq , PartialEq ) ]
111
111
pub enum Value {
112
112
/// Represents a JSON null value.
113
113
///
You can’t perform that action at this time.
0 commit comments