Skip to content

Commit

Permalink
address deprecation warnings
Browse files Browse the repository at this point in the history
- use non-deprecated methods where possible
- allow use of the deprecated methods only in the doctests *of* those
  deprecated methods.
  • Loading branch information
michaelkirk committed Feb 14, 2022
1 parent b2c3af0 commit 77479b7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion geo-types/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ impl<T: CoordNum> Geometry<T> {
///
/// ```
/// use geo_types::*;
/// use std::convert::TryInto;
///
/// let g = Geometry::Point(Point::new(0., 0.));
/// let p2: Point<f32> = g.into_point().unwrap();
/// let p2: Point<f32> = g.try_into().unwrap();
/// assert_eq!(p2, Point::new(0., 0.,));
/// ```
#[deprecated(
Expand Down
4 changes: 4 additions & 0 deletions geo-types/src/line_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@ impl<T: CoordNum> LineString<T> {
///
/// let mut coords = vec![(0., 0.), (5., 0.), (7., 9.)];
/// let line_string: LineString<f32> = coords.into_iter().collect();
///
/// # #[allow(deprecated)]
/// # {
/// assert_eq!(3, line_string.num_coords());
/// # }
/// ```
#[deprecated(note = "Use geo::algorithm::coords_iter::CoordsIter::coords_count instead")]
pub fn num_coords(&self) -> usize {
Expand Down
2 changes: 2 additions & 0 deletions geo-types/src/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ where
/// use geo_types::Point;
///
/// let mut p = Point::new(1.234, 2.345);
/// #[allow(deprecated)]
/// p.set_lng(9.876);
///
/// assert_eq!(p.x(), 9.876);
Expand Down Expand Up @@ -218,6 +219,7 @@ where
/// use geo_types::Point;
///
/// let mut p = Point::new(1.234, 2.345);
/// #[allow(deprecated)]
/// p.set_lat(9.876);
///
/// assert_eq!(p.y(), 9.876);
Expand Down

0 comments on commit 77479b7

Please sign in to comment.