Skip to content

Rollup of 4 pull requests #141529

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 17 commits into from
May 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
bebcb9d
Add test for Ord impl for Option::NonZero
clubby789 May 12, 2025
5eb47ee
Add failing tests for some Option optimizations
clubby789 May 12, 2025
5326fc9
rustdoc: on mobile, make the sidebar full width and linewrap
lolbinarycat Apr 15, 2025
d29d1a3
Docs(lib/alloc/vec): Add the missing `an` to `extract_if`'s first sen…
PaulDance May 17, 2025
cd5772e
Docs(lib/coll/hm): Reword `extract_if` to use `element` instead of `v…
PaulDance May 17, 2025
35f8473
Docs(lib/coll/btm): Split `extract_if`'s first sentence from the foll…
PaulDance May 17, 2025
9205ee2
Docs(lib/extract_if): Unify paragraph about closure actions
PaulDance May 17, 2025
014434e
Docs(lib/extract_if): Unify paragraph about elements mutation
PaulDance May 17, 2025
a9330dd
Docs(lib/coll/hm): Add kv pair to `extract_if`'s first sentence
PaulDance May 17, 2025
b1d7480
Docs(lib/extract_if): Unify example description
PaulDance May 17, 2025
1eba1b5
rustdoc: rip out all the gui tests for <100% width mobile sidebar
lolbinarycat May 22, 2025
89a8abc
use `cfg_select!` to select the right `VaListImpl` definition
folkertdev May 21, 2025
bcca611
rustdoc-gui test: apply suggestions from code review
lolbinarycat May 23, 2025
045ac21
Rollup merge of #139831 - lolbinarycat:rustdoc-mobile-sidebar, r=Guil…
jhpratt May 25, 2025
3f91bbc
Rollup merge of #140950 - clubby789:nonzero-ord-test, r=Mark-Simulacrum
jhpratt May 25, 2025
3338ff7
Rollup merge of #141108 - PaulDance:fix-extract_if-docs, r=Mark-Simul…
jhpratt May 25, 2025
c27b7c2
Rollup merge of #141361 - folkertdev:varargs-cfg, r=workingjubilee
jhpratt May 25, 2025
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
10 changes: 6 additions & 4 deletions library/alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1398,10 +1398,12 @@ impl<K, V, A: Allocator + Clone> BTreeMap<K, V, A> {
}

/// Creates an iterator that visits all elements (key-value pairs) in
/// ascending key order and uses a closure to determine if an element should
/// be removed. If the closure returns `true`, the element is removed from
/// the map and yielded. If the closure returns `false`, or panics, the
/// element remains in the map and will not be yielded.
/// ascending key order and uses a closure to determine if an element
/// should be removed.
///
/// If the closure returns `true`, the element is removed from the map and
/// yielded. If the closure returns `false`, or panics, the element remains
/// in the map and will not be yielded.
///
/// The iterator also lets you mutate the value of each element in the
/// closure, regardless of whether you choose to keep or remove it.
Expand Down
12 changes: 6 additions & 6 deletions library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,20 +1124,20 @@ impl<T, A: Allocator> LinkedList<T, A> {

/// Creates an iterator which uses a closure to determine if an element should be removed.
///
/// If the closure returns true, then the element is removed and yielded.
/// If the closure returns false, the element will remain in the list and will not be yielded
/// by the iterator.
/// If the closure returns `true`, the element is removed from the list and
/// yielded. If the closure returns `false`, or panics, the element remains
/// in the list and will not be yielded.
///
/// If the returned `ExtractIf` is not exhausted, e.g. because it is dropped without iterating
/// or the iteration short-circuits, then the remaining elements will be retained.
/// Use `extract_if().for_each(drop)` if you do not need the returned iterator.
///
/// Note that `extract_if` lets you mutate every element in the filter closure, regardless of
/// whether you choose to keep or remove it.
/// The iterator also lets you mutate the value of each element in the
/// closure, regardless of whether you choose to keep or remove it.
///
/// # Examples
///
/// Splitting a list into evens and odds, reusing the original list:
/// Splitting a list into even and odd values, reusing the original list:
///
/// ```
/// use std::collections::LinkedList;
Expand Down
14 changes: 7 additions & 7 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3648,11 +3648,11 @@ impl<T, A: Allocator> Vec<T, A> {
Splice { drain: self.drain(range), replace_with: replace_with.into_iter() }
}

/// Creates an iterator which uses a closure to determine if element in the range should be removed.
/// Creates an iterator which uses a closure to determine if an element in the range should be removed.
///
/// If the closure returns true, then the element is removed and yielded.
/// If the closure returns false, the element will remain in the vector and will not be yielded
/// by the iterator.
/// If the closure returns `true`, the element is removed from the vector
/// and yielded. If the closure returns `false`, or panics, the element
/// remains in the vector and will not be yielded.
///
/// Only elements that fall in the provided range are considered for extraction, but any elements
/// after the range will still have to be moved if any element has been extracted.
Expand Down Expand Up @@ -3692,16 +3692,16 @@ impl<T, A: Allocator> Vec<T, A> {
/// But `extract_if` is easier to use. `extract_if` is also more efficient,
/// because it can backshift the elements of the array in bulk.
///
/// Note that `extract_if` also lets you mutate the elements passed to the filter closure,
/// regardless of whether you choose to keep or remove them.
/// The iterator also lets you mutate the value of each element in the
/// closure, regardless of whether you choose to keep or remove it.
///
/// # Panics
///
/// If `range` is out of bounds.
///
/// # Examples
///
/// Splitting an array into evens and odds, reusing the original allocation:
/// Splitting a vector into even and odd values, reusing the original vector:
///
/// ```
/// let mut numbers = vec![1, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15];
Expand Down
Loading
Loading