From 3604944a4fd9d768130e9158b94f85f450b53631 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Mon, 2 Dec 2024 19:28:41 -0500 Subject: [PATCH] Update fmt/clippy for 1.83 (#130) * fmt * clippy --- src/deserialize/mod.rs | 6 +- src/lib.rs | 200 +++++++++++++++++++++++++------- src/tokenizer.rs | 4 +- src/types/geometrycollection.rs | 5 +- src/types/linestring.rs | 10 +- src/types/multilinestring.rs | 10 +- src/types/multipoint.rs | 10 +- src/types/multipolygon.rs | 10 +- src/types/point.rs | 10 +- src/types/polygon.rs | 10 +- 10 files changed, 217 insertions(+), 58 deletions(-) diff --git a/src/deserialize/mod.rs b/src/deserialize/mod.rs index 3f91a20..3eeee86 100644 --- a/src/deserialize/mod.rs +++ b/src/deserialize/mod.rs @@ -86,7 +86,7 @@ impl> Default for TryFromWktVisitor { } } -impl<'de, T, G> Visitor<'de> for TryFromWktVisitor +impl Visitor<'_> for TryFromWktVisitor where T: FromStr + Default + WktNum, G: TryFromWkt, @@ -116,7 +116,7 @@ impl Default for WktVisitor { } } -impl<'de, T> Visitor<'de> for WktVisitor +impl Visitor<'_> for WktVisitor where T: FromStr + Default + Debug + WktNum, { @@ -156,7 +156,7 @@ impl Default for GeometryVisitor { } } -impl<'de, T> Visitor<'de> for GeometryVisitor +impl Visitor<'_> for GeometryVisitor where T: FromStr + Default + WktNum, { diff --git a/src/lib.rs b/src/lib.rs index 717b0dc..64fa3db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -415,16 +415,46 @@ where impl GeometryTrait for Wkt { type T = T; - type PointType<'b> = Point where Self: 'b; - type LineStringType<'b> = LineString where Self: 'b; - type PolygonType<'b> = Polygon where Self: 'b; - type MultiPointType<'b> = MultiPoint where Self: 'b; - type MultiLineStringType<'b> = MultiLineString where Self: 'b; - type MultiPolygonType<'b> = MultiPolygon where Self: 'b; - type GeometryCollectionType<'b> = GeometryCollection where Self: 'b; - type RectType<'b> = geo_traits::UnimplementedRect where Self: 'b; - type LineType<'b> = geo_traits::UnimplementedLine where Self: 'b; - type TriangleType<'b> = geo_traits::UnimplementedTriangle where Self: 'b; + type PointType<'b> + = Point + where + Self: 'b; + type LineStringType<'b> + = LineString + where + Self: 'b; + type PolygonType<'b> + = Polygon + where + Self: 'b; + type MultiPointType<'b> + = MultiPoint + where + Self: 'b; + type MultiLineStringType<'b> + = MultiLineString + where + Self: 'b; + type MultiPolygonType<'b> + = MultiPolygon + where + Self: 'b; + type GeometryCollectionType<'b> + = GeometryCollection + where + Self: 'b; + type RectType<'b> + = geo_traits::UnimplementedRect + where + Self: 'b; + type LineType<'b> + = geo_traits::UnimplementedLine + where + Self: 'b; + type TriangleType<'b> + = geo_traits::UnimplementedTriangle + where + Self: 'b; fn dim(&self) -> geo_traits::Dimensions { match self { @@ -467,16 +497,46 @@ impl GeometryTrait for Wkt { impl GeometryTrait for &Wkt { type T = T; - type PointType<'b> = Point where Self: 'b; - type LineStringType<'b> = LineString where Self: 'b; - type PolygonType<'b> = Polygon where Self: 'b; - type MultiPointType<'b> = MultiPoint where Self: 'b; - type MultiLineStringType<'b> = MultiLineString where Self: 'b; - type MultiPolygonType<'b> = MultiPolygon where Self: 'b; - type GeometryCollectionType<'b> = GeometryCollection where Self: 'b; - type RectType<'b> = geo_traits::UnimplementedRect where Self: 'b; - type LineType<'b> = geo_traits::UnimplementedLine where Self: 'b; - type TriangleType<'b> = geo_traits::UnimplementedTriangle where Self: 'b; + type PointType<'b> + = Point + where + Self: 'b; + type LineStringType<'b> + = LineString + where + Self: 'b; + type PolygonType<'b> + = Polygon + where + Self: 'b; + type MultiPointType<'b> + = MultiPoint + where + Self: 'b; + type MultiLineStringType<'b> + = MultiLineString + where + Self: 'b; + type MultiPolygonType<'b> + = MultiPolygon + where + Self: 'b; + type GeometryCollectionType<'b> + = GeometryCollection + where + Self: 'b; + type RectType<'b> + = geo_traits::UnimplementedRect + where + Self: 'b; + type LineType<'b> + = geo_traits::UnimplementedLine + where + Self: 'b; + type TriangleType<'b> + = geo_traits::UnimplementedTriangle + where + Self: 'b; fn dim(&self) -> geo_traits::Dimensions { match self { @@ -523,16 +583,46 @@ macro_rules! impl_specialization { ($geometry_type:ident) => { impl GeometryTrait for $geometry_type { type T = T; - type PointType<'b> = Point where Self: 'b; - type LineStringType<'b> = LineString where Self: 'b; - type PolygonType<'b> = Polygon where Self: 'b; - type MultiPointType<'b> = MultiPoint where Self: 'b; - type MultiLineStringType<'b> = MultiLineString where Self: 'b; - type MultiPolygonType<'b> = MultiPolygon where Self: 'b; - type GeometryCollectionType<'b> = GeometryCollection where Self: 'b; - type RectType<'b> = geo_traits::UnimplementedRect where Self: 'b; - type LineType<'b> = geo_traits::UnimplementedLine where Self: 'b; - type TriangleType<'b> = geo_traits::UnimplementedTriangle where Self: 'b; + type PointType<'b> + = Point + where + Self: 'b; + type LineStringType<'b> + = LineString + where + Self: 'b; + type PolygonType<'b> + = Polygon + where + Self: 'b; + type MultiPointType<'b> + = MultiPoint + where + Self: 'b; + type MultiLineStringType<'b> + = MultiLineString + where + Self: 'b; + type MultiPolygonType<'b> + = MultiPolygon + where + Self: 'b; + type GeometryCollectionType<'b> + = GeometryCollection + where + Self: 'b; + type RectType<'b> + = geo_traits::UnimplementedRect + where + Self: 'b; + type LineType<'b> + = geo_traits::UnimplementedLine + where + Self: 'b; + type TriangleType<'b> + = geo_traits::UnimplementedTriangle + where + Self: 'b; fn dim(&self) -> geo_traits::Dimensions { geo_traits::Dimensions::Xy @@ -559,16 +649,46 @@ macro_rules! impl_specialization { impl<'a, T: WktNum + 'a> GeometryTrait for &'a $geometry_type { type T = T; - type PointType<'b> = Point where Self: 'b; - type LineStringType<'b> = LineString where Self: 'b; - type PolygonType<'b> = Polygon where Self: 'b; - type MultiPointType<'b> = MultiPoint where Self: 'b; - type MultiLineStringType<'b> = MultiLineString where Self: 'b; - type MultiPolygonType<'b> = MultiPolygon where Self: 'b; - type GeometryCollectionType<'b> = GeometryCollection where Self: 'b; - type RectType<'b> = geo_traits::UnimplementedRect where Self: 'b; - type LineType<'b> = geo_traits::UnimplementedLine where Self: 'b; - type TriangleType<'b> = geo_traits::UnimplementedTriangle where Self: 'b; + type PointType<'b> + = Point + where + Self: 'b; + type LineStringType<'b> + = LineString + where + Self: 'b; + type PolygonType<'b> + = Polygon + where + Self: 'b; + type MultiPointType<'b> + = MultiPoint + where + Self: 'b; + type MultiLineStringType<'b> + = MultiLineString + where + Self: 'b; + type MultiPolygonType<'b> + = MultiPolygon + where + Self: 'b; + type GeometryCollectionType<'b> + = GeometryCollection + where + Self: 'b; + type RectType<'b> + = geo_traits::UnimplementedRect + where + Self: 'b; + type LineType<'b> + = geo_traits::UnimplementedLine + where + Self: 'b; + type TriangleType<'b> + = geo_traits::UnimplementedTriangle + where + Self: 'b; fn dim(&self) -> geo_traits::Dimensions { geo_traits::Dimensions::Xy diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 3edd232..1e604bc 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -60,7 +60,7 @@ where } } -impl<'a, T> Iterator for Tokens<'a, T> +impl Iterator for Tokens<'_, T> where T: WktNum + str::FromStr, { @@ -102,7 +102,7 @@ where } } -impl<'a, T> Tokens<'a, T> +impl Tokens<'_, T> where T: str::FromStr, { diff --git a/src/types/geometrycollection.rs b/src/types/geometrycollection.rs index 04e3606..df47582 100644 --- a/src/types/geometrycollection.rs +++ b/src/types/geometrycollection.rs @@ -78,7 +78,10 @@ where impl GeometryCollectionTrait for GeometryCollection { type T = T; - type GeometryType<'a> = &'a Wkt where Self: 'a; + type GeometryType<'a> + = &'a Wkt + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT diff --git a/src/types/linestring.rs b/src/types/linestring.rs index 248771e..26c7350 100644 --- a/src/types/linestring.rs +++ b/src/types/linestring.rs @@ -55,7 +55,10 @@ where impl LineStringTrait for LineString { type T = T; - type CoordType<'a> = &'a Coord where Self: 'a; + type CoordType<'a> + = &'a Coord + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT @@ -77,7 +80,10 @@ impl LineStringTrait for LineString { impl LineStringTrait for &LineString { type T = T; - type CoordType<'a> = &'a Coord where Self: 'a; + type CoordType<'a> + = &'a Coord + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT diff --git a/src/types/multilinestring.rs b/src/types/multilinestring.rs index bad491c..373f58e 100644 --- a/src/types/multilinestring.rs +++ b/src/types/multilinestring.rs @@ -59,7 +59,10 @@ where impl MultiLineStringTrait for MultiLineString { type T = T; - type LineStringType<'a> = &'a LineString where Self: 'a; + type LineStringType<'a> + = &'a LineString + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT @@ -81,7 +84,10 @@ impl MultiLineStringTrait for MultiLineString { impl MultiLineStringTrait for &MultiLineString { type T = T; - type LineStringType<'a> = &'a LineString where Self: 'a; + type LineStringType<'a> + = &'a LineString + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT diff --git a/src/types/multipoint.rs b/src/types/multipoint.rs index b189afa..ac00d99 100644 --- a/src/types/multipoint.rs +++ b/src/types/multipoint.rs @@ -59,7 +59,10 @@ where impl MultiPointTrait for MultiPoint { type T = T; - type PointType<'a> = &'a Point where Self: 'a; + type PointType<'a> + = &'a Point + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT @@ -81,7 +84,10 @@ impl MultiPointTrait for MultiPoint { impl MultiPointTrait for &MultiPoint { type T = T; - type PointType<'a> = &'a Point where Self: 'a; + type PointType<'a> + = &'a Point + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT diff --git a/src/types/multipolygon.rs b/src/types/multipolygon.rs index e9e2619..d0420ea 100644 --- a/src/types/multipolygon.rs +++ b/src/types/multipolygon.rs @@ -59,7 +59,10 @@ where impl MultiPolygonTrait for MultiPolygon { type T = T; - type PolygonType<'a> = &'a Polygon where Self: 'a; + type PolygonType<'a> + = &'a Polygon + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT @@ -81,7 +84,10 @@ impl MultiPolygonTrait for MultiPolygon { impl MultiPolygonTrait for &MultiPolygon { type T = T; - type PolygonType<'a> = &'a Polygon where Self: 'a; + type PolygonType<'a> + = &'a Polygon + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT diff --git a/src/types/point.rs b/src/types/point.rs index b610612..64b13c8 100644 --- a/src/types/point.rs +++ b/src/types/point.rs @@ -55,7 +55,10 @@ where impl PointTrait for Point { type T = T; - type CoordType<'a> = &'a Coord where Self: 'a; + type CoordType<'a> + = &'a Coord + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { if let Some(coord) = &self.0 { @@ -73,7 +76,10 @@ impl PointTrait for Point { impl PointTrait for &Point { type T = T; - type CoordType<'a> = &'a Coord where Self: 'a; + type CoordType<'a> + = &'a Coord + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { if let Some(coord) = &self.0 { diff --git a/src/types/polygon.rs b/src/types/polygon.rs index b55a3ec..a3c45ed 100644 --- a/src/types/polygon.rs +++ b/src/types/polygon.rs @@ -59,7 +59,10 @@ where impl PolygonTrait for Polygon { type T = T; - type RingType<'a> = &'a LineString where Self: 'a; + type RingType<'a> + = &'a LineString + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT @@ -85,7 +88,10 @@ impl PolygonTrait for Polygon { impl PolygonTrait for &Polygon { type T = T; - type RingType<'a> = &'a LineString where Self: 'a; + type RingType<'a> + = &'a LineString + where + Self: 'a; fn dim(&self) -> geo_traits::Dimensions { // TODO: infer dimension from empty WKT