diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-12-17 11:36:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-17 11:36:49 +0100 |
| commit | 53af11651b448b34f21f63fb49e74f7186aed30e (patch) | |
| tree | cce3d8bcdcecc42a0c8382593bba3e92c2f5d8e2 | |
| parent | 6b83013d1f54a19e6fd704ce17619b07f83e22c2 (diff) | |
| parent | 6c7835e4410f820c2bcdcd3d34fa48f0053af7d4 (diff) | |
| download | rust-53af11651b448b34f21f63fb49e74f7186aed30e.tar.gz rust-53af11651b448b34f21f63fb49e74f7186aed30e.zip | |
Rollup merge of #80022 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeSet: simplify implementation of pop_first/pop_last …and stop it interfering in #79245. r? ```````@Mark-Simulacrum```````
| -rw-r--r-- | library/alloc/src/collections/btree/set.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index d8ce47ed77d..f63c3dd5804 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -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. @@ -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. |
