Fixing some clippy warnings

This commit is contained in:
Tomasz Drwięga
2016-11-28 13:20:49 +01:00
parent e1e7886918
commit 2b3d100de2
33 changed files with 72 additions and 81 deletions

View File

@@ -33,6 +33,13 @@ macro_rules! vec_into {
}
}
#[macro_export]
macro_rules! slice_into {
( $( $x:expr ),* ) => {
&[ $( $x.into() ),* ]
}
}
#[macro_export]
macro_rules! hash_map {
() => { HashMap::new() };

View File

@@ -236,7 +236,6 @@ mod tests {
use common::*;
use super::*;
use hashdb::*;
use journaldb::traits::JournalDB;
use kvdb::Database;

View File

@@ -556,7 +556,6 @@ mod tests {
use common::*;
use super::*;
use super::super::traits::JournalDB;
use hashdb::*;
use log::init_log;
use kvdb::{Database, DatabaseConfig};

View File

@@ -422,7 +422,6 @@ mod tests {
use common::*;
use super::*;
use hashdb::*;
use log::init_log;
use journaldb::JournalDB;
use kvdb::Database;

View File

@@ -217,7 +217,6 @@ mod tests {
use common::*;
use super::*;
use super::super::traits::JournalDB;
use hashdb::*;
#[test]
fn long_history() {

View File

@@ -628,7 +628,6 @@ impl Drop for Database {
#[cfg(test)]
mod tests {
use hash::*;
use super::*;
use devtools::*;
use std::str::FromStr;

View File

@@ -67,7 +67,7 @@ mod tests {
#[test]
fn check_histogram() {
let hist = Histogram::new(&vec_into![643,689,1408,2000,2296,2512,4250,4320,4842,4958,5804,6065,6098,6354,7002,7145,7845,8589,8593,8895], 5).unwrap();
let hist = Histogram::new(slice_into![643,689,1408,2000,2296,2512,4250,4320,4842,4958,5804,6065,6098,6354,7002,7145,7845,8589,8593,8895], 5).unwrap();
let correct_bounds: Vec<U256> = vec_into![643, 2294, 3945, 5596, 7247, 8898];
assert_eq!(Histogram { bucket_bounds: correct_bounds, counts: vec![4,2,4,6,4] }, hist);
}
@@ -75,7 +75,7 @@ mod tests {
#[test]
fn smaller_data_range_than_bucket_range() {
assert_eq!(
Histogram::new(&vec_into![1, 2, 2], 3),
Histogram::new(slice_into![1, 2, 2], 3),
Some(Histogram { bucket_bounds: vec_into![1, 2, 3, 4], counts: vec![1, 2, 0] })
);
}
@@ -83,7 +83,7 @@ mod tests {
#[test]
fn data_range_is_not_multiple_of_bucket_range() {
assert_eq!(
Histogram::new(&vec_into![1, 2, 5], 2),
Histogram::new(slice_into![1, 2, 5], 2),
Some(Histogram { bucket_bounds: vec_into![1, 4, 7], counts: vec![2, 1] })
);
}
@@ -91,13 +91,13 @@ mod tests {
#[test]
fn data_range_is_multiple_of_bucket_range() {
assert_eq!(
Histogram::new(&vec_into![1, 2, 6], 2),
Histogram::new(slice_into![1, 2, 6], 2),
Some(Histogram { bucket_bounds: vec_into![1, 4, 7], counts: vec![2, 1] })
);
}
#[test]
fn none_when_too_few_data() {
assert!(Histogram::new(&vec_into![], 1).is_none());
assert!(Histogram::new(slice_into![], 1).is_none());
}
}