Skip to content

Commit

Permalink
Remove unnecessary references in function signatures.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Feb 16, 2019
1 parent f4ed057 commit 2a6e9f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions geo-types/src/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ where
///
/// assert_eq!(p.x(), 1.234);
/// ```
pub fn x(&self) -> T {
pub fn x(self) -> T {
self.0.x
}

Expand Down Expand Up @@ -97,7 +97,7 @@ where
///
/// assert_eq!(p.y(), 2.345);
/// ```
pub fn y(&self) -> T {
pub fn y(self) -> T {
self.0.y
}

Expand Down Expand Up @@ -131,7 +131,7 @@ where
/// assert_eq!(y, 2.345);
/// assert_eq!(x, 1.234);
/// ```
pub fn x_y(&self) -> (T, T) {
pub fn x_y(self) -> (T, T) {
(self.0.x, self.0.y)
}
/// Returns the longitude/horizontal component of the point.
Expand Down Expand Up @@ -213,7 +213,7 @@ where
///
/// assert_eq!(dot, 5.25);
/// ```
pub fn dot(&self, other: Point<T>) -> T {
pub fn dot(self, other: Point<T>) -> T {
self.x() * other.x() + self.y() * other.y()
}

Expand All @@ -234,7 +234,7 @@ where
///
/// assert_eq!(cross, 2.0)
/// ```
pub fn cross_prod(&self, point_b: Point<T>, point_c: Point<T>) -> T {
pub fn cross_prod(self, point_b: Point<T>, point_c: Point<T>) -> T {
(point_b.x() - self.x()) * (point_c.y() - self.y())
- (point_b.y() - self.y()) * (point_c.x() - self.x())
}
Expand All @@ -255,7 +255,7 @@ where
/// assert_eq!(x.round(), 71.0);
/// assert_eq!(y.round(), 134.0);
/// ```
pub fn to_degrees(&self) -> Point<T> {
pub fn to_degrees(self) -> Point<T> {
let (x, y) = self.x_y();
let x = x.to_degrees();
let y = y.to_degrees();
Expand All @@ -273,7 +273,7 @@ where
/// assert_eq!(x.round(), 3.0);
/// assert_eq!(y.round(), 6.0);
/// ```
pub fn to_radians(&self) -> Point<T> {
pub fn to_radians(self) -> Point<T> {
let (x, y) = self.x_y();
let x = x.to_radians();
let y = y.to_radians();
Expand Down
6 changes: 3 additions & 3 deletions geo-types/src/polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ where
}

/// Wrap-around previous-vertex
fn previous_vertex(&self, current_vertex: &usize) -> usize
fn previous_vertex(&self, current_vertex: usize) -> usize
where
T: Float,
{
Expand Down Expand Up @@ -393,8 +393,8 @@ where
.iter()
.enumerate()
.map(|(idx, _)| {
let prev_1 = self.previous_vertex(&idx);
let prev_2 = self.previous_vertex(&prev_1);
let prev_1 = self.previous_vertex(idx);
let prev_2 = self.previous_vertex(prev_1);
Point(self.exterior.0[prev_2])
.cross_prod(Point(self.exterior.0[prev_1]), Point(self.exterior.0[idx]))
})
Expand Down

0 comments on commit 2a6e9f8

Please sign in to comment.