diff --git a/src/geometry/point.rs b/src/geometry/point.rs index 8499fddc..0d24ab1f 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -19,7 +19,7 @@ use base::{DefaultAllocator, Scalar, VectorN}; /// A point in a n-dimensional euclidean space. #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Point where DefaultAllocator: Allocator { @@ -41,17 +41,7 @@ impl Copy for Point where DefaultAllocator: Allocator, >::Buffer: Copy, -{} - -impl Clone for Point -where - DefaultAllocator: Allocator, - >::Buffer: Clone, { - #[inline] - fn clone(&self) -> Self { - Point::from(self.coords.clone()) - } } #[cfg(feature = "serde-serialize")] @@ -104,13 +94,6 @@ where impl Point where DefaultAllocator: Allocator { - /// Clones this point into one that owns its data. - #[inline] - #[deprecated(note = "This will be removed. Use the `.clone()` method from the `Clone` trait instead.")] - pub fn clone(&self) -> Point { - Point::from(self.coords.clone_owned()) - } - /// Converts this point into a vector in homogeneous coordinates, i.e., appends a `1` at the /// end of it. /// diff --git a/tests/geometry/point.rs b/tests/geometry/point.rs index 90c51587..896a09d6 100644 --- a/tests/geometry/point.rs +++ b/tests/geometry/point.rs @@ -1,7 +1,13 @@ -#![cfg(feature = "arbitrary")] use na::{Point3, Vector3, Vector4}; use num::Zero; +#[test] +fn point_clone() { + let p = Point3::new(1.0, 2.0, 3.0); + let p2 = p.clone(); + assert_eq!(p, p2); +} + #[test] fn point_ops() { let a = Point3::new(1.0, 2.0, 3.0); @@ -87,7 +93,10 @@ fn to_homogeneous() { assert_eq!(a.to_homogeneous(), expected); } -quickcheck!(fn point_sub(pt1: Point3, pt2: Point3) -> bool { - let dpt = &pt2 - &pt1; - relative_eq!(pt2, pt1 + dpt, epsilon = 1.0e-7) -}); +#[cfg(feature = "arbitrary")] +quickcheck!( + fn point_sub(pt1: Point3, pt2: Point3) -> bool { + let dpt = &pt2 - &pt1; + relative_eq!(pt2, pt1 + dpt, epsilon = 1.0e-7) + } +);