Auto merge of #87598 - ccqpein:master, r=yaahc
Add doctests for HashMap's into_values and into_keys methods Fixes #87591
This commit is contained in:
commit
1c0485610e
1 changed files with 10 additions and 2 deletions
|
@ -969,7 +969,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")]
|
||||
|
@ -991,7 +995,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")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue