diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/zerovec/src/hashmap | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/zerovec/src/hashmap')
-rw-r--r-- | vendor/zerovec/src/hashmap/mod.rs | 18 | ||||
-rw-r--r-- | vendor/zerovec/src/hashmap/serde.rs | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/vendor/zerovec/src/hashmap/mod.rs b/vendor/zerovec/src/hashmap/mod.rs index 5d91114ad..e3aed1198 100644 --- a/vendor/zerovec/src/hashmap/mod.rs +++ b/vendor/zerovec/src/hashmap/mod.rs @@ -20,8 +20,8 @@ mod serde; /// ``` /// use zerovec::ZeroHashMap; /// -/// let kv = vec![(0, "a"), (1, "b"), (2, "c")]; -/// let hashmap: ZeroHashMap<i32, str> = ZeroHashMap::from_iter(kv.into_iter()); +/// let hashmap = +/// ZeroHashMap::<i32, str>::from_iter([(0, "a"), (1, "b"), (2, "c")]); /// assert_eq!(hashmap.get(&0), Some("a")); /// assert_eq!(hashmap.get(&2), Some("c")); /// assert_eq!(hashmap.get(&4), None); @@ -91,8 +91,7 @@ where /// ``` /// use zerovec::ZeroHashMap; /// - /// let hashmap: ZeroHashMap<str, str> = - /// ZeroHashMap::from_iter(vec![("a", "A"), ("z", "Z")].into_iter()); + /// let hashmap = ZeroHashMap::<str, str>::from_iter([("a", "A"), ("z", "Z")]); /// /// assert_eq!(hashmap.get("a"), Some("A")); /// assert_eq!(hashmap.get("z"), Some("Z")); @@ -111,8 +110,7 @@ where /// ```rust /// use zerovec::ZeroHashMap; /// - /// let hashmap: ZeroHashMap<str, str> = - /// ZeroHashMap::from_iter(vec![("a", "A"), ("z", "Z")].into_iter()); + /// let hashmap = ZeroHashMap::<str, str>::from_iter([("a", "A"), ("z", "Z")]); /// /// assert!(hashmap.contains_key("a")); /// assert!(!hashmap.contains_key("p")); @@ -176,8 +174,12 @@ where /// ``` /// use zerovec::ZeroHashMap; /// - /// let kv: Vec<(i32, &str)> = vec![(1, "a"), (2, "b"), (3, "c"), (4, "d")]; - /// let hashmap: ZeroHashMap<i32, str> = ZeroHashMap::from_iter(kv.into_iter()); + /// let hashmap = ZeroHashMap::<i32, str>::from_iter([ + /// (1, "a"), + /// (2, "b"), + /// (3, "c"), + /// (4, "d"), + /// ]); /// assert_eq!(hashmap.get(&1), Some("a")); /// assert_eq!(hashmap.get(&2), Some("b")); /// assert_eq!(hashmap.get(&3), Some("c")); diff --git a/vendor/zerovec/src/hashmap/serde.rs b/vendor/zerovec/src/hashmap/serde.rs index 2d724ac05..7a4941205 100644 --- a/vendor/zerovec/src/hashmap/serde.rs +++ b/vendor/zerovec/src/hashmap/serde.rs @@ -77,7 +77,7 @@ mod test { } fn make_zerohashmap() -> ZeroHashMap<'static, u32, str> { - ZeroHashMap::from_iter(vec![(0, "a"), (1, "b"), (2, "c")].into_iter()) + ZeroHashMap::from_iter([(0, "a"), (1, "b"), (2, "c")]) } fn build_invalid_hashmap_str( |