File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to
11
11
- cosmwasm-vm: Add ` Cache::save_wasm_unchecked ` to save Wasm blobs that have
12
12
been checked before. This is useful for state-sync where we know the Wasm code
13
13
was checked when it was first uploaded. ([ #1635 ] )
14
+ - cosmwasm-std: Implement ` PartialEq ` for ` Addr == &Addr ` and ` &Addr == Addr ` .
14
15
15
16
[ #1635 ] : https://github.com/CosmWasm/cosmwasm/pull/1635
16
17
Original file line number Diff line number Diff line change @@ -85,6 +85,20 @@ impl AsRef<str> for Addr {
85
85
}
86
86
}
87
87
88
+ /// Implement `Addr == &Addr`
89
+ impl PartialEq < & Addr > for Addr {
90
+ fn eq ( & self , rhs : & & Addr ) -> bool {
91
+ self == * rhs
92
+ }
93
+ }
94
+
95
+ /// Implement `&Addr == Addr`
96
+ impl PartialEq < Addr > for & Addr {
97
+ fn eq ( & self , rhs : & Addr ) -> bool {
98
+ self == rhs
99
+ }
100
+ }
101
+
88
102
/// Implement `Addr == &str`
89
103
///
90
104
/// Deprecated. This comparison unsafe. Convert both sides to Addr first.
@@ -457,6 +471,17 @@ mod tests {
457
471
assert_eq ! ( String :: from( "cos934gh9034hg04g0h134" ) , addr) ;
458
472
}
459
473
474
+ #[ test]
475
+ fn addr_implements_partial_eq_addr_ref ( ) {
476
+ let addr = Addr :: unchecked ( "cos934gh9034hg04g0h134" ) ;
477
+ let addr_ref = & addr;
478
+
479
+ // `Addr == &Addr`
480
+ assert_eq ! ( addr, addr_ref) ;
481
+ // `&Addr == Addr`
482
+ assert_eq ! ( addr_ref, addr) ;
483
+ }
484
+
460
485
#[ test]
461
486
fn addr_implements_into_string ( ) {
462
487
// owned Addr
You can’t perform that action at this time.
0 commit comments