update pr to use From::from

This commit is contained in:
debris 2016-01-13 22:05:10 +01:00
parent dfc1be8a6e
commit 90645e30a6

View File

@ -18,17 +18,7 @@ pub fn bytes_from_json(json: &Json) -> Bytes {
}
pub fn address_from_json(json: &Json) -> Address {
address_from_str(json.as_string().unwrap_or("0000000000000000000000000000000000000000"))
}
pub fn address_from_str<'a>(s: &'a str) -> Address {
if s.len() == 0 {
Address::new()
} else if s.len() % 2 == 1 {
address_from_hex(&("0".to_string() + &(clean(s).to_string()))[..])
} else {
address_from_hex(clean(s))
}
From::from(json.as_string().unwrap_or("0000000000000000000000000000000000000000"))
}
pub fn h256_from_json(json: &Json) -> H256 {