Use `rustc-hex v2.0` with explicit types

The issue was that the trait `FromHex` has changed and is now using
`FromIterator<u8>` instead of `FromIterator<Vec<u8>>` and was `inferred`
to `[u8]` instead of `Vec<u8>`. Thus, has not compile-time size and
won't work!

Well, this could be improved to be stack allocated because
we know the `size` of the hexstring but in this case I think
is sufficient and only used in tests!
This commit is contained in:
Niklas Adofsson 2018-08-23 11:53:30 +02:00
parent 6a2ca88536
commit 0d1133ef75
2 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ serde = { version = "1.0", optional = true }
[dev-dependencies]
rand = { version = "0.4" }
rustc-hex = "1.0.0"
rustc-hex = "2.0"
[features]
default = ["std", "heapsizeof", "serialize", "fixed-hash/libc"]

View File

@ -7,8 +7,8 @@
//!
//! fn main() {
//! let bloom: Bloom = "00000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002020000000000000000000000000000000000000000000008000000001000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".into();
//! let address = "ef2d6d194084c2de36e0dabfce45d046b37d1106".from_hex().unwrap();
//! let topic = "02c69be41d0b7e40352fc85be1cd65eb03d40ef8427a0ca4596b1ead9a00e9fc".from_hex().unwrap();
//! let address: Vec<u8> = "ef2d6d194084c2de36e0dabfce45d046b37d1106".from_hex().unwrap();
//! let topic: Vec<u8> = "02c69be41d0b7e40352fc85be1cd65eb03d40ef8427a0ca4596b1ead9a00e9fc".from_hex().unwrap();
//!
//! let mut my_bloom = Bloom::default();
//! assert!(!my_bloom.contains_input(Input::Raw(&address)));
@ -261,8 +261,8 @@ mod tests {
#[test]
fn it_works() {
let bloom: Bloom = "00000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002020000000000000000000000000000000000000000000008000000001000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".into();
let address = "ef2d6d194084c2de36e0dabfce45d046b37d1106".from_hex().unwrap();
let topic = "02c69be41d0b7e40352fc85be1cd65eb03d40ef8427a0ca4596b1ead9a00e9fc".from_hex().unwrap();
let address: Vec<u8> = "ef2d6d194084c2de36e0dabfce45d046b37d1106".from_hex().unwrap();
let topic: Vec<u8> = "02c69be41d0b7e40352fc85be1cd65eb03d40ef8427a0ca4596b1ead9a00e9fc".from_hex().unwrap();
let mut my_bloom = Bloom::default();
assert!(!my_bloom.contains_input(Input::Raw(&address)));