Skip to content

Commit 6d33f7e

Browse files
Remove num-traits and ordered-float (#143)
### Checklist * [x] I have read the [Contributor Guide](../../CONTRIBUTING.md) * [x] I have read and agree to the [Code of Conduct](../../CODE_OF_CONDUCT.md) * [x] I have added a description of my changes and why I'd like them included in the section below ### Description of Changes This removes `ordered-float` as a dependency and replaces it with `tiny-ordered-float` which supports just enough use-cases for this library. This is mostly done to remove the (very slow to compile) transitive dependency `num-traits` for this crate so we can keep it lean and mean. Notice that this doesn't remove `num-traits` from the `Cargo.lock` because the optional `macaw` dependency still wants it, but we don't use that feature so I'll leave removing `num-traits` there as an exercise for the reader.
1 parent aad308f commit 6d33f7e

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

Cargo.lock

+7-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/mirror-mirror/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ macaw = ["dep:macaw"]
2323
ahash = { version = "0.8.2", default-features = false }
2424
mirror-mirror-macros = { path = "../mirror-mirror-macros", version = "0.1.4" }
2525
once_cell = { version = "1.16", features = ["alloc", "race", "critical-section"], default-features = false }
26-
ordered-float = { version = "4", default-features = false }
26+
tiny-ordered-float = { version = "0.4", default-features = false }
2727
serde = { version = "1.0.158", default-features = false, features = ["derive", "alloc"], optional = true }
2828
speedy = { version = "0.8.5", optional = true }
2929
syn = { version = "2.0", features = ["full", "parsing"], optional = true }

crates/mirror-mirror/src/value.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use core::fmt;
99
use core::hash::Hash;
1010
use core::hash::Hasher;
1111

12-
use ordered_float::OrderedFloat;
12+
use tiny_ordered_float::{OrderedF32, OrderedF64};
1313

1414
use crate::enum_::EnumValue;
1515
use crate::struct_::StructValue;
@@ -83,8 +83,8 @@ enum OrdEqHashValue<'a> {
8383
i128(i128),
8484
bool(bool),
8585
char(char),
86-
f32(OrderedFloat<f32>),
87-
f64(OrderedFloat<f64>),
86+
f32(OrderedF32),
87+
f64(OrderedF64),
8888
String(&'a str),
8989
StructValue(&'a StructValue),
9090
EnumValue(&'a EnumValue),
@@ -110,8 +110,8 @@ impl<'a> From<&'a Value> for OrdEqHashValue<'a> {
110110
Value::i128(inner) => OrdEqHashValue::i128(*inner),
111111
Value::bool(inner) => OrdEqHashValue::bool(*inner),
112112
Value::char(inner) => OrdEqHashValue::char(*inner),
113-
Value::f32(inner) => OrdEqHashValue::f32(OrderedFloat(*inner)),
114-
Value::f64(inner) => OrdEqHashValue::f64(OrderedFloat(*inner)),
113+
Value::f32(inner) => OrdEqHashValue::f32(OrderedF32(*inner)),
114+
Value::f64(inner) => OrdEqHashValue::f64(OrderedF64(*inner)),
115115
Value::String(inner) => OrdEqHashValue::String(inner),
116116
Value::StructValue(inner) => OrdEqHashValue::StructValue(inner),
117117
Value::EnumValue(inner) => OrdEqHashValue::EnumValue(inner),

0 commit comments

Comments
 (0)