Address various clippy lints, improve comments

This commit is contained in:
Paul Hauner
2019-04-29 14:04:52 +10:00
parent 52695c29e8
commit a90bbbfd82
4 changed files with 35 additions and 27 deletions

View File

@@ -65,7 +65,7 @@ pub fn new_tree_hash_cache<T: CachedTreeHash>(
Ok((cache, schema))
}
pub fn produce_schema<T: CachedTreeHash>(vec: &Vec<T>, depth: usize) -> BTreeSchema {
pub fn produce_schema<T: CachedTreeHash>(vec: &[T], depth: usize) -> BTreeSchema {
let lengths = match T::tree_hash_type() {
TreeHashType::Basic => {
// Ceil division.
@@ -89,6 +89,7 @@ pub fn produce_schema<T: CachedTreeHash>(vec: &Vec<T>, depth: usize) -> BTreeSch
BTreeSchema::from_lengths(depth, lengths)
}
#[allow(clippy::range_plus_one)] // Minor readability lint requiring structural changes; not worth it.
pub fn update_tree_hash_cache<T: CachedTreeHash>(
vec: &Vec<T>,
cache: &mut TreeHashCache,
@@ -294,7 +295,7 @@ where
//
}
fn get_packed_leaves<T>(vec: &Vec<T>) -> Result<Vec<u8>, Error>
fn get_packed_leaves<T>(vec: &[T]) -> Result<Vec<u8>, Error>
where
T: CachedTreeHash,
{