Repository: becheran/grid (language: rust)

Issue:
error[E0369]: binary operation `==` cannot be applied to type `grid::Grid<{float}>`
Sorry if this is due to my lack of understanding of Rust, I'm still learning the language.

```rust
assert_eq(vec![1], vec![1]); // works
assert_eq(vec![1.0], vec![1.0]); // works
assert_eq(grid![[1]], grid![[1]]); // works
assert_eq(grid![[1.0]], grid![[1.0]]); // doesn't work
```



Discussion / hints:

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index e527fba..da5d835 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1574,7 +1574,7 @@ impl<T: fmt::Debug> fmt::Debug for Grid<T> {
     }
 }
 
-impl<T: Eq> PartialEq for Grid<T> {
+impl<T: PartialEq> PartialEq for Grid<T> {
     fn eq(&self, other: &Self) -> bool {
         if self.rows != other.rows || self.cols != other.cols {
             return false;
@@ -2181,6 +2181,19 @@ mod test {
         assert_eq!(grid, grid2);
     }
 
+    #[test]
+    fn equal_partial_eq() {
+        let grid = grid![[1.0]];
+        let grid2 = Grid::from_vec(vec![1.0], 1);
+        assert_eq!(grid, grid2);
+    }
+
+    #[test]
+    fn ne_partial_eq() {
+        let grid = grid![[f64::NAN]];
+        assert_ne!(grid, grid);
+    }
+
     #[test]
     #[should_panic]
     #[allow(clippy::should_panic_without_expect)]


Test patch: