From d172859878bc2ef1e7d3ff75ebf0dd9cb2545303 Mon Sep 17 00:00:00 2001 From: Bastien Jacot-Guillarmod Date: Fri, 12 Apr 2024 01:59:01 -0700 Subject: [PATCH] Copybara import of the project: -- 4b67c374d49b00860a8f285aae2e064cc58a0dc7 by Bastien Jacot-Guillarmod : Make `ActualT` in `Matcher` a generic type parameter. -- 7e34d847f2cda5387e55ac436ded30cc6d07bcaa by Bastien Jacot-Guillarmod : Accept all `Copy` type for `ActualT` instead of only reference. PiperOrigin-RevId: 624094573 --- rust/BUILD | 8 ++++++-- rust/map.rs | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rust/BUILD b/rust/BUILD index 1f731e3ee4..df5b8a3ba5 100644 --- a/rust/BUILD +++ b/rust/BUILD @@ -85,7 +85,9 @@ rust_library( rust_test( name = "protobuf_upb_test", crate = ":protobuf_upb", - rustc_flags = ["--cfg=upb_kernel"], + rustc_flags = [ + "--cfg=upb_kernel", + ], deps = [ "@crate_index//:googletest", ], @@ -113,7 +115,9 @@ rust_library( rust_test( name = "protobuf_cpp_test", crate = ":protobuf_cpp", - rustc_flags = ["--cfg=cpp_kernel"], + rustc_flags = [ + "--cfg=cpp_kernel", + ], deps = [ "@crate_index//:googletest", ], diff --git a/rust/map.rs b/rust/map.rs index 36eb390aa0..05285d098d 100644 --- a/rust/map.rs +++ b/rust/map.rs @@ -543,7 +543,7 @@ mod tests { ] ); assert_that!( - map.as_mut().iter().collect::>(), + map.as_view().into_iter().collect::>(), unordered_elements_are![ eq((3, ProtoStr::from_str("fizz"))), eq((5, ProtoStr::from_str("buzz"))), @@ -559,7 +559,6 @@ mod tests { assert!(map_mut.insert(0, "fizz")); // insert should return false when the key is already present assert!(!map_mut.insert(0, "buzz")); - assert_that!( map.as_mut().iter().collect::>(), unordered_elements_are![eq((0, ProtoStr::from_str("buzz"))),]