summaryrefslogtreecommitdiffstats
path: root/vendor/litemap/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/litemap/tests')
-rw-r--r--vendor/litemap/tests/rkyv.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/vendor/litemap/tests/rkyv.rs b/vendor/litemap/tests/rkyv.rs
index 2d6438dc7..7ab1eb3f5 100644
--- a/vendor/litemap/tests/rkyv.rs
+++ b/vendor/litemap/tests/rkyv.rs
@@ -41,17 +41,14 @@ type LiteMapOfStrings = LiteMap<String, String>;
type TupleVecOfStrings = Vec<(String, String)>;
fn generate() -> AlignedVec {
- let mut map: LiteMapOfStrings = LiteMap::new();
- for (lang, name) in DATA.iter() {
- map.try_append(lang.to_string(), name.to_string())
- .ok_or(())
- .unwrap_err();
- }
- let tuple_vec = map.into_tuple_vec();
+ let map = DATA
+ .iter()
+ .map(|&(k, v)| (k.to_owned(), v.to_owned()))
+ .collect::<LiteMapOfStrings>();
let mut serializer = AllocSerializer::<4096>::default();
serializer
- .serialize_value(&tuple_vec)
+ .serialize_value(&map.into_tuple_vec())
.expect("failed to archive test");
serializer.into_serializer().into_inner()
}
@@ -82,5 +79,5 @@ fn rkyv_deserialize() {
let deserialized = archived.deserialize(&mut Infallible).unwrap();
// Safe because we are deserializing a buffer from a trusted source
let deserialized: LiteMapOfStrings = LiteMap::from_sorted_store_unchecked(deserialized);
- assert_eq!(deserialized.get("tr"), Some(&"Turkish".to_string()));
+ assert_eq!(deserialized.get("tr").map(String::as_str), Some("Turkish"));
}