Skip to content

Commit 8f2e972

Browse files
committed
impl Diffable for f32, f64 and use Same for all primitives instead of Eq
1 parent 59cef2c commit 8f2e972

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

diffus/src/diffable_impls/primitives.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ macro_rules! primitive_impl {
77
type Diff = (&'a $typ, &'a $typ);
88

99
fn diff(&'a self, other: &'a Self) -> edit::Edit<Self> {
10-
if self == other {
10+
use crate::Same;
11+
if self.same(other) {
1112
edit::Edit::Copy(self)
1213
} else {
1314
edit::Edit::Change((self, other))
@@ -18,7 +19,7 @@ macro_rules! primitive_impl {
1819
}
1920
}
2021

21-
primitive_impl! { i64, i32, i16, i8, u64, u32, u16, u8, char, bool, isize, usize, () }
22+
primitive_impl! { i64, i32, i16, i8, u64, u32, u16, u8, char, bool, isize, usize, f32, f64, () }
2223

2324
#[cfg(feature = "uuid-impl")]
2425
primitive_impl! { uuid::Uuid }

diffus/src/same.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ macro_rules! same_for_eq {
2222
}
2323
}
2424

25-
same_for_eq! { u8, u16, u32, u64, i8, i16, i32, i64, char, str, String }
25+
same_for_eq! { i64, i32, i16, i8, u64, u32, u16, u8, char, str, bool, isize, usize, () }
2626

2727
macro_rules! same_for_float {
2828
($($typ:ty),*) => {

0 commit comments

Comments
 (0)