Rustify core/src/core (#1122)

Small refactoring of one folder, if it makes sense I could extend the scope.
* Remove some cloning (real and just verbosity in the code)
* Naming conventions like to/into*
* Some Clippy's suggestions

I found that we don't use field init shorthand syntax, so I didn't touch this part, was it discussed before?
This commit is contained in:
hashmap
2018-06-01 21:41:26 +02:00
committed by Yeastplume
parent 7812a02233
commit 2fa32d15ce
27 changed files with 215 additions and 263 deletions
+1 -1
View File
@@ -568,7 +568,7 @@ impl BlockHandler {
))?;
}
let vec = util::from_hex(input).unwrap();
Ok(Hash::from_vec(vec))
Ok(Hash::from_vec(&vec))
}
}
+2 -2
View File
@@ -53,7 +53,7 @@ impl Tip {
height: tip.height,
last_block_pushed: util::to_hex(tip.last_block_h.to_vec()),
prev_block_to_last: util::to_hex(tip.prev_block_h.to_vec()),
total_difficulty: tip.total_difficulty.into_num(),
total_difficulty: tip.total_difficulty.to_num(),
}
}
}
@@ -497,7 +497,7 @@ impl BlockHeaderPrintable {
range_proof_root: util::to_hex(h.range_proof_root.to_vec()),
kernel_root: util::to_hex(h.kernel_root.to_vec()),
nonce: h.nonce,
total_difficulty: h.total_difficulty.into_num(),
total_difficulty: h.total_difficulty.to_num(),
total_kernel_offset: h.total_kernel_offset.to_hex(),
}
}