22use approx:: { AbsDiffEq , RelativeEq } ;
33
44use crate :: { Coord , CoordNum , Line , Point , Triangle } ;
5- use std:: iter:: FromIterator ;
6- use std:: ops:: { Index , IndexMut } ;
5+ use alloc:: vec;
6+ use alloc:: vec:: Vec ;
7+ use core:: iter:: FromIterator ;
8+ use core:: ops:: { Index , IndexMut } ;
79
810/// An ordered collection of two or more [`Coord`]s, representing a
911/// path between locations.
@@ -136,7 +138,7 @@ pub struct LineString<T: CoordNum = f64>(pub Vec<Coord<T>>);
136138
137139/// A [`Point`] iterator returned by the `points` method
138140#[ derive( Debug ) ]
139- pub struct PointsIter < ' a , T : CoordNum + ' a > ( :: std :: slice:: Iter < ' a , Coord < T > > ) ;
141+ pub struct PointsIter < ' a , T : CoordNum + ' a > ( :: core :: slice:: Iter < ' a , Coord < T > > ) ;
140142
141143impl < ' a , T : CoordNum > Iterator for PointsIter < ' a , T > {
142144 type Item = Point < T > ;
@@ -164,7 +166,7 @@ impl<'a, T: CoordNum> DoubleEndedIterator for PointsIter<'a, T> {
164166
165167/// A [`Coord`] iterator used by the `into_iter` method on a [`LineString`]
166168#[ derive( Debug ) ]
167- pub struct CoordinatesIter < ' a , T : CoordNum + ' a > ( :: std :: slice:: Iter < ' a , Coord < T > > ) ;
169+ pub struct CoordinatesIter < ' a , T : CoordNum + ' a > ( :: core :: slice:: Iter < ' a , Coord < T > > ) ;
168170
169171impl < ' a , T : CoordNum > Iterator for CoordinatesIter < ' a , T > {
170172 type Item = & ' a Coord < T > ;
@@ -358,7 +360,7 @@ impl<T: CoordNum, IC: Into<Coord<T>>> FromIterator<IC> for LineString<T> {
358360/// Iterate over all the [`Coord`]s in this [`LineString`].
359361impl < T : CoordNum > IntoIterator for LineString < T > {
360362 type Item = Coord < T > ;
361- type IntoIter = :: std :: vec:: IntoIter < Coord < T > > ;
363+ type IntoIter = :: alloc :: vec:: IntoIter < Coord < T > > ;
362364
363365 fn into_iter ( self ) -> Self :: IntoIter {
364366 self . 0 . into_iter ( )
@@ -377,9 +379,9 @@ impl<'a, T: CoordNum> IntoIterator for &'a LineString<T> {
377379/// Mutably iterate over all the [`Coordinate`]s in this [`LineString`]
378380impl < ' a , T : CoordNum > IntoIterator for & ' a mut LineString < T > {
379381 type Item = & ' a mut Coord < T > ;
380- type IntoIter = :: std :: slice:: IterMut < ' a , Coord < T > > ;
382+ type IntoIter = :: core :: slice:: IterMut < ' a , Coord < T > > ;
381383
382- fn into_iter ( self ) -> :: std :: slice:: IterMut < ' a , Coord < T > > {
384+ fn into_iter ( self ) -> :: core :: slice:: IterMut < ' a , Coord < T > > {
383385 self . 0 . iter_mut ( )
384386 }
385387}
@@ -534,14 +536,15 @@ mod test {
534536 #[ test]
535537 fn test_exact_size ( ) {
536538 // see https://github.com/georust/geo/issues/762
537- let ls = LineString :: new ( vec ! [ coord! { x: 0. , y: 0. } , coord! { x: 10. , y: 0. } ] ) ;
539+ let first = coord ! { x: 0. , y: 0. } ;
540+ let ls = LineString :: new ( vec ! [ first, coord! { x: 10. , y: 0. } ] ) ;
538541
539542 // reference to force the `impl IntoIterator for &LineString` impl, giving a `CoordinatesIter`
540543 for c in ( & ls) . into_iter ( ) . rev ( ) . skip ( 1 ) . rev ( ) {
541- println ! ( "{:?}" , c) ;
544+ assert_eq ! ( & first , c) ;
542545 }
543546 for p in ( & ls) . points ( ) . rev ( ) . skip ( 1 ) . rev ( ) {
544- println ! ( "{:?}" , p) ;
547+ assert_eq ! ( Point :: from ( first ) , p) ;
545548 }
546549 }
547550
0 commit comments