apple / swift-algorithms

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

Add @discardableResult attribute to stablePartition #174

Closed adincebic closed 1 year ago

adincebic commented 2 years ago

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

adincebic commented 2 years ago

@swift-ci Please smoke test

glessard commented 2 years ago

@swift-ci please test

glessard commented 2 years ago

Why add @discardableResult on stablePartition but not partition?

natecook1000 commented 1 year ago

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!