Pass slices instead of &Vec

This commit is contained in:
Jack Grigg 2020-10-30 13:37:55 +00:00
parent 0cb51f963c
commit 01f0d7dcda
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@ use zcash_history::{Entry, EntryLink, NodeData, Tree};
#[path = "lib/shared.rs"] #[path = "lib/shared.rs"]
mod share; mod share;
fn draft(into: &mut Vec<(u32, Entry)>, vec: &Vec<NodeData>, peak_pos: usize, h: u32) { fn draft(into: &mut Vec<(u32, Entry)>, vec: &[NodeData], peak_pos: usize, h: u32) {
let node_data = vec[peak_pos - 1].clone(); let node_data = vec[peak_pos - 1].clone();
let peak: Entry = match h { let peak: Entry = match h {
0 => node_data.into(), 0 => node_data.into(),
@ -19,7 +19,7 @@ fn draft(into: &mut Vec<(u32, Entry)>, vec: &Vec<NodeData>, peak_pos: usize, h:
into.push(((peak_pos - 1) as u32, peak)); into.push(((peak_pos - 1) as u32, peak));
} }
fn prepare_tree(vec: &Vec<NodeData>) -> Tree { fn prepare_tree(vec: &[NodeData]) -> Tree {
assert!(!vec.is_empty()); assert!(!vec.is_empty());
// integer log2 of (vec.len()+1), -1 // integer log2 of (vec.len()+1), -1