swift-algorithms
swift-algorithms copied to clipboard
Add @discardableResult attribute to stablePartition
- [x] I've completed this task
- [ ] This task isn't completed
Since stablePartition is used frequently in contexts where it's return result isn't needed, I added @discardableResult attribute to both public methods for stablePartition to avoid Xcode's warning about unused result of call to stablePartition.
Checklist
- [ ] I've added at least one test that validates that my change is working, if appropriate
- [x] I've followed the code style of the rest of the project
- [x] I've read the Contribution Guidelines
- [ ] I've updated the documentation if necessary
@swift-ci Please smoke test
@swift-ci please test
Why add @discardableResult
on stablePartition
but not partition
?
Thanks for your contribution, @adincebic! I don't think there are frequent cases where you want to partition a collection but don't care about where the partition is — partitioning is generally used as part of a larger algorithm, and further processing depends on the position of the partition. Feel free to start a thread on the Swift forums if you'd like to discuss further!