Fix warnings.
This commit is contained in:
parent
b334a8f824
commit
cf62f67b5f
@ -1,5 +1,4 @@
|
||||
use hash::*;
|
||||
use bytes::Bytes;
|
||||
|
||||
pub trait HashDB {
|
||||
/// Look up a given hash into the bytes that hash to it, returning None if the
|
||||
|
@ -104,9 +104,8 @@ impl MemoryDB {
|
||||
pub fn denote(&self, key: &H256, value: Bytes) -> &(Bytes, i32) {
|
||||
if self.data.get(&key) == None {
|
||||
unsafe {
|
||||
let p = &self.data as *const HashMap<H256, (Bytes, i32)>;
|
||||
let mp = p as *mut HashMap<H256, (Bytes, i32)>;
|
||||
(*mp).insert(key.clone(), (value, 0));
|
||||
let p = &self.data as *const HashMap<H256, (Bytes, i32)> as *mut HashMap<H256, (Bytes, i32)>;
|
||||
(*p).insert(key.clone(), (value, 0));
|
||||
}
|
||||
}
|
||||
self.data.get(key).unwrap()
|
||||
@ -161,7 +160,7 @@ fn memorydb_denote() {
|
||||
let hash = m.insert(hello_bytes);
|
||||
assert_eq!(m.lookup(&hash).unwrap(), b"Hello world!");
|
||||
|
||||
for i in 0..1000 {
|
||||
for _ in 0..1000 {
|
||||
let r = H256::random();
|
||||
let k = r.sha3();
|
||||
let &(ref v, ref rc) = m.denote(&k, r.bytes().to_vec());
|
||||
|
@ -8,7 +8,6 @@ use hashdb::*;
|
||||
use memorydb::*;
|
||||
use std::ops::*;
|
||||
use std::sync::*;
|
||||
use std::cell::*;
|
||||
use std::env;
|
||||
use rocksdb::{DB, Writable};
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
use memorydb::*;
|
||||
use hashdb::*;
|
||||
use hash::*;
|
||||
use rlp::*;
|
||||
use bytes::*;
|
||||
//use rlp::*;
|
||||
//use bytes::*;
|
||||
|
||||
pub const NULL_RLP: [u8; 1] = [0x80; 1];
|
||||
pub const SHA3_NULL_RLP: H256 = H256( [0x56, 0xe8, 0x1f, 0x17, 0x1b, 0xcc, 0x55, 0xa6, 0xff, 0x83, 0x45, 0xe6, 0x92, 0xc0, 0xf8, 0x6e, 0x5b, 0x48, 0xe0, 0x1b, 0x99, 0x6c, 0xad, 0xc0, 0x01, 0x62, 0x2f, 0xb5, 0xe3, 0x63, 0xb4, 0x21] );
|
||||
|
Loading…
Reference in New Issue
Block a user