Skip to content

Commit ddfa568

Browse files
committed
primitives - BalancesMap - change Deref impl to AsRef<[u8]>
1 parent f0d41d8 commit ddfa568

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

primitives/src/balances_map.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ use std::collections::btree_map::{Entry, Iter, Values};
66

77
use serde::{Deserialize, Serialize};
88
use std::iter::FromIterator;
9-
use std::ops::Deref;
109

1110
#[derive(Debug, Clone, Serialize, Deserialize, PartialOrd, Ord, PartialEq, Eq)]
1211
#[serde(transparent)]
1312
pub struct BalancesKey(#[serde(with = "SerHexSeq::<StrictPfx>")] Vec<u8>);
14-
impl Deref for BalancesKey {
15-
type Target = Vec<u8>;
16-
17-
fn deref(&self) -> &Self::Target {
13+
impl AsRef<[u8]> for BalancesKey {
14+
fn as_ref(&self) -> &[u8] {
1815
&self.0
1916
}
2017
}
@@ -82,7 +79,7 @@ mod test {
8279
let actual_json = serde_json::to_string(&balances_map).expect("Should serialize it");
8380

8481
let balances_map_from_json: BalancesMap =
85-
serde_json::from_str(&string).expect("Should deserialize it");
82+
serde_json::from_str(&actual_json).expect("Should deserialize it");
8683

8784
assert_eq!(balances_map, balances_map_from_json);
8885
}

0 commit comments

Comments
 (0)