Skip to content

Add doctests for HashMap's into_values and into_keys methods #87598

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
Aug 23, 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
12 changes: 10 additions & 2 deletions library/std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,11 @@ where
/// map.insert("b", 2);
/// map.insert("c", 3);
///
/// let vec: Vec<&str> = map.into_keys().collect();
/// let mut vec: Vec<&str> = map.into_keys().collect();
/// // The `IntoKeys` iterator produces keys in arbitrary order, so the
/// // keys must be sorted to test them against a sorted array.
/// vec.sort_unstable();
/// assert_eq!(vec, ["a", "b", "c"]);
/// ```
#[inline]
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
Expand All @@ -993,7 +997,11 @@ where
/// map.insert("b", 2);
/// map.insert("c", 3);
///
/// let vec: Vec<i32> = map.into_values().collect();
/// let mut vec: Vec<i32> = map.into_values().collect();
/// // The `IntoValues` iterator produces values in arbitrary order, so
/// // the values must be sorted to test them against a sorted array.
/// vec.sort_unstable();
/// assert_eq!(vec, [1, 2, 3]);
/// ```
#[inline]
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
Expand Down