Skip to content

Make BTreeSet::split_off name elements like other set methods do #87090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions library/alloc/src/collections/btree/set.rs
Original file line number Diff line number Diff line change
@@ -903,8 +903,8 @@ impl<T> BTreeSet<T> {
self.map.append(&mut other.map);
}

/// Splits the collection into two at the given key. Returns everything after the given key,
/// including the key.
/// Splits the collection into two at the given value. Returns everything after the given value,
/// including the value.
///
/// # Examples
///
@@ -933,11 +933,11 @@ impl<T> BTreeSet<T> {
/// assert!(b.contains(&41));
/// ```
#[stable(feature = "btree_split_off", since = "1.11.0")]
pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
pub fn split_off<Q: ?Sized + Ord>(&mut self, value: &Q) -> Self
where
T: Borrow<Q> + Ord,
{
BTreeSet { map: self.map.split_off(key) }
BTreeSet { map: self.map.split_off(value) }
}

/// Creates an iterator that visits all values in ascending order and uses a closure