Skip to content

Commit d7e8f1b

Browse files
Rollup merge of #140825 - rs-sac:ext, r=workingjubilee
Add Range parameter to `BTreeMap::extract_if` and `BTreeSet::extract_if` This new parameter was requested in the btree_extract_if tracking issue: rust-lang/rust#70530 (comment) I attempted to follow the style used by `Vec::extract_if`. Before: ```rust impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> { #[unstable(feature = "btree_extract_if", issue = "70530")] pub fn extract_if<F>(&mut self, pred: F) -> ExtractIf<'_, K, V, F, A> where K: Ord, F: FnMut(&K, &mut V) -> bool; } ``` After: ```rust impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> { #[unstable(feature = "btree_extract_if", issue = "70530")] pub fn extract_if<F, R>(&mut self, range: R, pred: F) -> ExtractIf<'_, K, V, R, F, A> where K: Ord, R: RangeBounds<K>, F: FnMut(&K, &mut V) -> bool; } ``` Related: #70530 — While I believe I have adjusted all of the necessary bits, as this is my first attempt to contribute to Rust, I may have overlooked something out of ignorance, but if you can point out any oversight, I shall attempt to remedy it.
2 parents fd81512 + 7183ebe commit d7e8f1b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/pass/btreemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn main() {
5050
test_all_refs(&mut 13, b.values_mut());
5151

5252
// Test forgetting the extractor.
53-
let mut d = b.extract_if(|_, i| *i < 30);
53+
let mut d = b.extract_if(.., |_, i| *i < 30);
5454
d.next().unwrap();
5555
mem::forget(d);
5656
}

0 commit comments

Comments
 (0)