Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compact_str/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ castaway = { version = "0.2.3", default-features = false, features = ["alloc"] }
cfg-if = "1"
itoa = "1"
rustversion = "1"
ryu = "1"
zmij = "0.1"
static_assertions = "1"

[dev-dependencies]
Expand Down
10 changes: 5 additions & 5 deletions compact_str/src/repr/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) trait IntoRepr {
impl IntoRepr for f32 {
#[inline]
fn into_repr(self) -> Result<Repr, ToCompactStringError> {
let mut buf = ryu::Buffer::new();
let mut buf = zmij::Buffer::new();
let s = buf.format(self);
Ok(Repr::new(s)?)
}
Expand All @@ -23,7 +23,7 @@ impl IntoRepr for f32 {
impl IntoRepr for f64 {
#[inline]
fn into_repr(self) -> Result<Repr, ToCompactStringError> {
let mut buf = ryu::Buffer::new();
let mut buf = zmij::Buffer::new();
let s = buf.format(self);
Ok(Repr::new(s)?)
}
Expand Down Expand Up @@ -114,15 +114,15 @@ mod tests {
let repr = f64::into_repr(val).unwrap();
let roundtrip = repr.as_str().parse::<f64>().unwrap();

// Note: The formatting of floats by `ryu` sometimes differs from that of `std`, so instead
// Note: The formatting of floats by `zmij` sometimes differs from that of `std`, so instead
// of asserting equality with `std` we just make sure the value roundtrips

if val.is_nan() != roundtrip.is_nan() {
assert_eq!(val, roundtrip);
}
}

// `f32` formatting is broken on powerpc64le, not only in `ryu` but also `std`
// `f32` formatting is broken on powerpc64le, not only in `zmij` but also `std`
//
// See: https://github.com/rust-lang/rust/issues/96306
#[test]
Expand Down Expand Up @@ -158,7 +158,7 @@ mod tests {
let repr = f32::into_repr(val).unwrap();
let roundtrip = repr.as_str().parse::<f32>().unwrap();

// Note: The formatting of floats by `ryu` sometimes differs from that of `std`, so instead
// Note: The formatting of floats by `zmij` sometimes differs from that of `std`, so instead
// of asserting equality with `std` we just make sure the value roundtrips

if val.is_nan() != roundtrip.is_nan() {
Expand Down
2 changes: 1 addition & 1 deletion compact_str/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ fn test_to_compact_string() {
assert_int_MAX_to_compact_string!(usize);
assert_int_MAX_to_compact_string!(isize);

// Test specialisation for f32 and f64 using ryu
// Test specialisation for f32 and f64 using zmij
// TODO: Fix bug in powerpc64, which is a little endian system
#[cfg(not(all(target_arch = "powerpc64", target_pointer_width = "64")))]
{
Expand Down
2 changes: 1 addition & 1 deletion compact_str/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ unsafe impl LifetimeFree for Repr {}
/// * `char`
/// * `String`, `CompactString`
/// * `f32`, `f64`
/// * For floats we use [`ryu`] crate which sometimes provides different formatting than [`std`]
/// * For floats we use [`zmij`] crate which sometimes provides different formatting than [`std`]
impl<T: fmt::Display> ToCompactString for T {
#[inline]
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError> {
Expand Down
2 changes: 1 addition & 1 deletion fuzz/src/creation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ impl Creation<'_> {
NumType::I128(val) => (val.to_compact_string(), val.to_string()),
NumType::Usize(val) => (val.to_compact_string(), val.to_string()),
NumType::Isize(val) => (val.to_compact_string(), val.to_string()),
// Note: The formatting of floats by `ryu` sometimes differs from that of
// Note: The formatting of floats by `zmij` sometimes differs from that of
// `std`, so instead of asserting equality with `std` we just make sure the
// value roundtrips
NumType::F32(val) => {
Expand Down