apple / swift-algorithms

Commonly used sequence and collection algorithms for Swift
Apache License 2.0
5.97k stars 443 forks source link

Clean up early exit checks #11

Closed Saklad5 closed 3 years ago

Saklad5 commented 4 years ago

This pull request cleans up some of the early exits in the algorithms, either by changing them to use guard or by removing them entirely if they seem clearly redundant.

I’m new to this project, so I cannot rule out the possibility of errors. I ran the unit tests and checked everything manually, but a regression may have been introduced even by changes as simple as this.

I have also not run performance profiling to confirm my changes have no negative impact.

Finally, as there is no official code style for this project, I cannot be sure that I have followed it. The existing code seems to follow normal Swift library conventions, but I may have overlooked something.

Checklist

natecook1000 commented 3 years ago

Closing, as we've decided not to take PRs for this kind of refactoring. Feel free to check the issues for other ideas of how to contribute. Thanks!