Skip to content

Commit

Permalink
Merge #665
Browse files Browse the repository at this point in the history
665: Clippy: Remove .clone() where possible. r=lnicola a=martinfrances107

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md).
---

Looking at the output of `cargo clippy`

I want to cherry pick the single aspect I find most troublesome. 
In general it is better to use copy over clone.
It has been fixed in a couple of places.


Co-authored-by: Martin <[email protected]>
Co-authored-by: martin frances <[email protected]>
  • Loading branch information
bors[bot] and martinfrances107 authored Oct 13, 2021
2 parents 058cadc + 7022dd3 commit f43af7a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion geo/src/algorithm/intersects/polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ where
T: GeoNum,
{
fn intersects(&self, rect: &Rect<T>) -> bool {
self.intersects(&rect.clone().to_polygon())
self.intersects(&rect.to_polygon())
}
}
symmetric_intersects_impl!(Rect<T>, Polygon<T>);
Expand Down
2 changes: 1 addition & 1 deletion geo/src/algorithm/intersects/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ where
Polygon<T>: Intersects<G>,
{
fn intersects(&self, rhs: &G) -> bool {
self.clone().to_polygon().intersects(rhs)
self.to_polygon().intersects(rhs)
}
}
symmetric_intersects_impl!(Coordinate<T>, Triangle<T>);
Expand Down
2 changes: 1 addition & 1 deletion geo/src/algorithm/relate/geomgraph/geometry_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ where
/// Add a point computed externally. The point is assumed to be a
/// Point Geometry part, which has a location of INTERIOR.
fn add_point(&mut self, point: &Point<F>) {
self.insert_point(self.arg_index, point.clone().into(), CoordPos::Inside);
self.insert_point(self.arg_index, (*point).into(), CoordPos::Inside);
}

/// Compute self-nodes, taking advantage of the Geometry type to minimize the number of
Expand Down

0 comments on commit f43af7a

Please sign in to comment.