swift-algorithms icon indicating copy to clipboard operation
swift-algorithms copied to clipboard

Add @discardableResult attribute to stablePartition

Open adincebic opened this issue 3 years ago • 3 comments

  • [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

adincebic avatar Nov 28 '21 19:11 adincebic

@swift-ci Please smoke test

adincebic avatar Nov 29 '21 11:11 adincebic

@swift-ci please test

glessard avatar Nov 29 '21 14:11 glessard

Why add @discardableResult on stablePartition but not partition?

glessard avatar Jan 19 '22 20:01 glessard

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!

natecook1000 avatar Jul 20 '23 22:07 natecook1000