Skip to content

Commit

Permalink
Rollup merge of rust-lang#80022 - ssomers:btree_cleanup_8, r=Mark-Sim…
Browse files Browse the repository at this point in the history
…ulacrum

BTreeSet: simplify implementation of pop_first/pop_last

…and stop it interfering in rust-lang#79245.
r? ````@Mark-Simulacrum````
  • Loading branch information
Dylan-DPC authored Dec 16, 2020
2 parents dd694f2 + 6c7835e commit 51007f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ impl<T: Ord> BTreeSet<T> {
/// ```
#[unstable(feature = "map_first_last", issue = "62924")]
pub fn pop_first(&mut self) -> Option<T> {
self.map.first_entry().map(|entry| entry.remove_entry().0)
self.map.pop_first().map(|kv| kv.0)
}

/// Removes the last value from the set and returns it, if any.
Expand All @@ -701,7 +701,7 @@ impl<T: Ord> BTreeSet<T> {
/// ```
#[unstable(feature = "map_first_last", issue = "62924")]
pub fn pop_last(&mut self) -> Option<T> {
self.map.last_entry().map(|entry| entry.remove_entry().0)
self.map.pop_last().map(|kv| kv.0)
}

/// Adds a value to the set.
Expand Down

0 comments on commit 51007f5

Please sign in to comment.