We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 68b75db + 6c7835e commit 1068f94Copy full SHA for 1068f94
library/alloc/src/collections/btree/set.rs
@@ -679,7 +679,7 @@ impl<T: Ord> BTreeSet<T> {
679
/// ```
680
#[unstable(feature = "map_first_last", issue = "62924")]
681
pub fn pop_first(&mut self) -> Option<T> {
682
- self.map.first_entry().map(|entry| entry.remove_entry().0)
+ self.map.pop_first().map(|kv| kv.0)
683
}
684
685
/// Removes the last value from the set and returns it, if any.
@@ -701,7 +701,7 @@ impl<T: Ord> BTreeSet<T> {
701
702
703
pub fn pop_last(&mut self) -> Option<T> {
704
- self.map.last_entry().map(|entry| entry.remove_entry().0)
+ self.map.pop_last().map(|kv| kv.0)
705
706
707
/// Adds a value to the set.
0 commit comments