From c1e99d20afff5c32423b1207983f5edbce36ee00 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 19 Mar 2022 15:48:52 -0400 Subject: [PATCH] test fix, clippy --- geo-types/src/coordinate.rs | 7 ++++++- geo-types/src/error.rs | 2 +- geo-types/src/line.rs | 10 +++++----- geo-types/src/line_string.rs | 11 ++++------- geo-types/src/novalue.rs | 5 +++-- geo-types/src/point.rs | 2 +- geo/Cargo.toml | 2 +- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/geo-types/src/coordinate.rs b/geo-types/src/coordinate.rs index f11ad3be1b..1a71e17256 100644 --- a/geo-types/src/coordinate.rs +++ b/geo-types/src/coordinate.rs @@ -147,7 +147,12 @@ impl Add for CoordTZM { type Output = Self; fn add(self, rhs: Self) -> Self { - Self::new(self.x + rhs.x, self.y + rhs.y, self.z + rhs.z, self.m + rhs.m) + Self::new( + self.x + rhs.x, + self.y + rhs.y, + self.z + rhs.z, + self.m + rhs.m, + ) } } diff --git a/geo-types/src/error.rs b/geo-types/src/error.rs index 6735759c1c..76622d5ea2 100644 --- a/geo-types/src/error.rs +++ b/geo-types/src/error.rs @@ -38,7 +38,7 @@ mod test { let failure = Point::try_from(rect_geometry).unwrap_err(); assert_eq!( failure.to_string(), - "Expected a geo_types::point::PointTZM, but found a geo_types::rect::RectTZM" + "Expected a geo_types::point::PointTZM, but found a geo_types::rect::RectTZM" ); } } diff --git a/geo-types/src/line.rs b/geo-types/src/line.rs index b08a01203a..864e5b8bd5 100644 --- a/geo-types/src/line.rs +++ b/geo-types/src/line.rs @@ -1,4 +1,4 @@ -use crate::{CoordNum, CoordTZM, Coordinate, Measure, NoValue, Point, PointTZM, ZCoord}; +use crate::{CoordNum, CoordTZM, Coordinate, Measure, NoValue, PointTZM, ZCoord}; #[cfg(any(feature = "approx", test))] use approx::{AbsDiffEq, RelativeEq}; @@ -236,11 +236,11 @@ impl + CoordNum> AbsDiffEq for Line { #[cfg(any(feature = "rstar_0_8", feature = "rstar_0_9"))] macro_rules! impl_rstar_line { ($rstar:ident) => { - impl ::$rstar::RTreeObject for Line + impl ::$rstar::RTreeObject for crate::Line where T: ::num_traits::Float + ::$rstar::RTreeNum, { - type Envelope = ::$rstar::AABB>; + type Envelope = ::$rstar::AABB>; fn envelope(&self) -> Self::Envelope { let bounding_rect = crate::private_utils::line_bounding_rect(*self); @@ -248,11 +248,11 @@ macro_rules! impl_rstar_line { } } - impl ::$rstar::PointDistance for Line + impl ::$rstar::PointDistance for crate::Line where T: ::num_traits::Float + ::$rstar::RTreeNum, { - fn distance_2(&self, point: &Point) -> T { + fn distance_2(&self, point: &crate::Point) -> T { let d = crate::private_utils::point_line_euclidean_distance(*point, *self); d.powi(2) } diff --git a/geo-types/src/line_string.rs b/geo-types/src/line_string.rs index 63c3ee7db5..356c0716be 100644 --- a/geo-types/src/line_string.rs +++ b/geo-types/src/line_string.rs @@ -1,6 +1,3 @@ -#[cfg(any(feature = "approx", test))] -use approx::{AbsDiffEq, RelativeEq}; - use crate::{CoordNum, CoordTZM, LineTZM, Measure, NoValue, Point, PointTZM, TriangleTZM, ZCoord}; use std::iter::FromIterator; use std::ops::{Index, IndexMut}; @@ -400,9 +397,9 @@ impl IndexMut for LineStringTZM RelativeEq for LineString +impl approx::RelativeEq for LineString where - T: AbsDiffEq + CoordNum + RelativeEq, + T: approx::AbsDiffEq + CoordNum + approx::RelativeEq, { #[inline] fn default_max_relative() -> Self::Epsilon { @@ -447,7 +444,7 @@ where } #[cfg(any(feature = "approx", test))] -impl + CoordNum> AbsDiffEq for LineString { +impl + CoordNum> approx::AbsDiffEq for LineString { type Epsilon = T; #[inline] @@ -530,7 +527,7 @@ impl_rstar_line_string!(rstar_0_9); mod test { use super::*; use crate::{coord, Line}; - use approx::AbsDiffEq; + use approx::{AbsDiffEq, RelativeEq}; #[test] fn test_exact_size() { diff --git a/geo-types/src/novalue.rs b/geo-types/src/novalue.rs index a8a36edc5f..67de97e1d7 100644 --- a/geo-types/src/novalue.rs +++ b/geo-types/src/novalue.rs @@ -1,7 +1,8 @@ -use std::ops::{Add, Div, Mul, Neg, Sub, Rem}; -use std::fmt::Debug; +#[cfg(any(feature = "approx", test))] use approx::AbsDiffEq; use num_traits::Zero; +use std::fmt::Debug; +use std::ops::{Add, Div, Mul, Neg, Rem, Sub}; #[derive(Eq, PartialEq, Clone, Copy, Debug, Hash, Default)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] diff --git a/geo-types/src/point.rs b/geo-types/src/point.rs index 85ed1ac159..e3efc4b085 100644 --- a/geo-types/src/point.rs +++ b/geo-types/src/point.rs @@ -614,7 +614,7 @@ where #[cfg(test)] mod test { use super::*; - + #[cfg(any(feature = "approx", test))] use approx::AbsDiffEq; #[test] diff --git a/geo/Cargo.toml b/geo/Cargo.toml index 2ade6742ed..f4547826b8 100644 --- a/geo/Cargo.toml +++ b/geo/Cargo.toml @@ -33,7 +33,7 @@ criterion = "0.3" geo-test-fixtures = { path = "../geo-test-fixtures" } # jts-test-runner is an internal crate which exists only to be part of the geo test suite. # As such it's kept unpublished. It's in a separate repo primarily because it's kind of large. -jts-test-runner = { git = "https://github.com/nyurik/jts-test-runner", branch = "bump" } +jts-test-runner = { git = "https://github.com/georust/jts-test-runner" } pretty_env_logger = "0.4" rand = "0.8.0"