From 01f0d7dcda61d9e891f8e89ad09f1149c381a507 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 30 Oct 2020 13:37:55 +0000 Subject: [PATCH] Pass slices instead of &Vec --- zcash_history/examples/long.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zcash_history/examples/long.rs b/zcash_history/examples/long.rs index a2b2b9077..bcd8d39f0 100644 --- a/zcash_history/examples/long.rs +++ b/zcash_history/examples/long.rs @@ -3,7 +3,7 @@ use zcash_history::{Entry, EntryLink, NodeData, Tree}; #[path = "lib/shared.rs"] mod share; -fn draft(into: &mut Vec<(u32, Entry)>, vec: &Vec, 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 peak: Entry = match h { 0 => node_data.into(), @@ -19,7 +19,7 @@ fn draft(into: &mut Vec<(u32, Entry)>, vec: &Vec, peak_pos: usize, h: into.push(((peak_pos - 1) as u32, peak)); } -fn prepare_tree(vec: &Vec) -> Tree { +fn prepare_tree(vec: &[NodeData]) -> Tree { assert!(!vec.is_empty()); // integer log2 of (vec.len()+1), -1