Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/lib/src/model/merkle_tree/merkle_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ impl HexHash {
pub fn node_db_prefix(&self) -> PathBuf {
let hash_str = &self.0;
const DIR_PREFIX_LEN: usize = 3;
let dir_prefix = &hash_str[0..DIR_PREFIX_LEN];
let dir_suffix = &hash_str[DIR_PREFIX_LEN..];
Path::new(dir_prefix).join(dir_suffix)
let dir_prefix = hash_str.chars().take(DIR_PREFIX_LEN).collect::<String>();
let dir_suffix = hash_str.chars().skip(DIR_PREFIX_LEN).collect::<String>();
Path::new(&dir_prefix).join(&dir_suffix)
Comment thread
malcolmgreaves marked this conversation as resolved.
}
}

Expand Down Expand Up @@ -158,7 +158,7 @@ mod tests {

#[test]
fn test_hex_hash_conversions_and_node_db_prefix() {
for _ in [0..1000] {
for _ in 0..1000 {
let random_value: u128 = rand::random();
let hash = MerkleHash::new(random_value);

Expand Down
Loading