georust / geographiclib-rs

A port of geographiclib in Rust.
MIT License
41 stars 9 forks source link

Resolve clippy warnings and errors #45

Closed Quba1 closed 2 years ago

Quba1 commented 2 years ago

This PR solves all Clippy warnings and errors present in the codebase. It also silences Clippy warnings that I evaluated as false-positives (eg. excessive_precision) or that required too significant changes (eg. too_many_arguments).

Changes do not seem to have any significant impact on the performance, but they solve some issues mentioned in #32 so this PR may be a start towards performance improvement.

The PR is split into so many commits for easier review, but it should probably be stashed after the review.

Quba1 commented 2 years ago

I've also added a few common trait implementations using derive macro for Geodesic and GeodesicLine. It's mostly a QoL change but it also satisfies one of the Rust API Guidelines Checklist rules (C-COMMON-TRAITS). And this PR feels like a good place to add this change.

michaelkirk commented 2 years ago

I've also added a few common trait implementations using derive macro for Geodesic and GeodesicLine. It's mostly a QoL change but it also satisfies one of the Rust API Guidelines Checklist rules (C-COMMON-TRAITS). And this PR feels like a good place to add this change.

The derived Default implementation seems strange to me - please remove it.

There are so many parameters in that struct, many which have a particular relationship. It seems extremely unlikely that anything reasonable could be made by having them all equal 0, as the derived implementation does.

Quba1 commented 2 years ago

I'm sorry, my oversight. I've removed the Default traits.

michaelkirk commented 2 years ago

Thanks!