diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /vendor/zerovec/src/map | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.tar.xz rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/zerovec/src/map')
-rw-r--r-- | vendor/zerovec/src/map/borrowed.rs | 14 | ||||
-rw-r--r-- | vendor/zerovec/src/map/map.rs | 4 | ||||
-rw-r--r-- | vendor/zerovec/src/map/serde.rs | 8 |
3 files changed, 8 insertions, 18 deletions
diff --git a/vendor/zerovec/src/map/borrowed.rs b/vendor/zerovec/src/map/borrowed.rs index 4c1d1aef6..9d0854601 100644 --- a/vendor/zerovec/src/map/borrowed.rs +++ b/vendor/zerovec/src/map/borrowed.rs @@ -163,11 +163,6 @@ where /// let borrowed = map.as_borrowed(); /// assert_eq!(borrowed.get(&1), Some("one")); /// assert_eq!(borrowed.get(&3), None); - /// - /// let borrow = borrowed.get(&1); - /// drop(borrowed); - /// // still exists after the ZeroMapBorrowed has been dropped - /// assert_eq!(borrow, Some("one")); /// ``` pub fn get(&self, key: &K) -> Option<&'a V::GetType> { let index = self.keys.zvl_binary_search(key).ok()?; @@ -190,11 +185,6 @@ where /// let borrowed = map.as_borrowed(); /// assert_eq!(borrowed.get_by(|probe| probe.cmp(&1)), Some("one")); /// assert_eq!(borrowed.get_by(|probe| probe.cmp(&3)), None); - /// - /// let borrow = borrowed.get_by(|probe| probe.cmp(&1)); - /// drop(borrowed); - /// // still exists after the ZeroMapBorrowed has been dropped - /// assert_eq!(borrow, Some("one")); /// ``` pub fn get_by(&self, predicate: impl FnMut(&K) -> Ordering) -> Option<&'a V::GetType> { let index = self.keys.zvl_binary_search_by(predicate).ok()?; @@ -211,8 +201,8 @@ where /// map.insert(&1, "one"); /// map.insert(&2, "two"); /// let borrowed = map.as_borrowed(); - /// assert_eq!(borrowed.contains_key(&1), true); - /// assert_eq!(borrowed.contains_key(&3), false); + /// assert!(borrowed.contains_key(&1)); + /// assert!(!borrowed.contains_key(&3)); /// ``` pub fn contains_key(&self, key: &K) -> bool { self.keys.zvl_binary_search(key).is_ok() diff --git a/vendor/zerovec/src/map/map.rs b/vendor/zerovec/src/map/map.rs index 379b22667..692e265d6 100644 --- a/vendor/zerovec/src/map/map.rs +++ b/vendor/zerovec/src/map/map.rs @@ -194,8 +194,8 @@ where /// let mut map = ZeroMap::new(); /// map.insert(&1, "one"); /// map.insert(&2, "two"); - /// assert_eq!(map.contains_key(&1), true); - /// assert_eq!(map.contains_key(&3), false); + /// assert!(map.contains_key(&1)); + /// assert!(!map.contains_key(&3)); /// ``` pub fn contains_key(&self, key: &K) -> bool { self.keys.zvl_binary_search(key).is_ok() diff --git a/vendor/zerovec/src/map/serde.rs b/vendor/zerovec/src/map/serde.rs index dbe4b433d..e82886d2a 100644 --- a/vendor/zerovec/src/map/serde.rs +++ b/vendor/zerovec/src/map/serde.rs @@ -9,7 +9,7 @@ use serde::de::{self, Deserialize, Deserializer, MapAccess, SeqAccess, Visitor}; #[cfg(feature = "serde")] use serde::ser::{Serialize, SerializeMap, SerializeSeq, Serializer}; -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl<'a, K, V> Serialize for ZeroMap<'a, K, V> where @@ -49,7 +49,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate #[cfg(feature = "serde")] impl<'a, K, V> Serialize for ZeroMapBorrowed<'a, K, V> where @@ -158,7 +158,7 @@ where } } -/// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +/// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, K, V> Deserialize<'de> for ZeroMap<'a, K, V> where K: ZeroMapKV<'a> + Ord + ?Sized, @@ -190,7 +190,7 @@ where } } -// /// This impl can be made available by enabling the optional `serde` feature of the `zerovec` crate +// /// This impl requires enabling the optional `serde` Cargo feature of the `zerovec` crate impl<'de, 'a, K, V> Deserialize<'de> for ZeroMapBorrowed<'a, K, V> where K: ZeroMapKV<'a> + Ord + ?Sized, |