From 3e4e161e9958897f70988d97500c7ce37b51b406 Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Mon, 30 Sep 2024 11:17:13 +0800 Subject: [PATCH] cleanup --- src/lib.rs | 19 +++++++++---------- src/report/mod.rs | 8 +------- src/report/plain_reporter.rs | 7 +------ src/report/table_reporter.rs | 7 +------ 4 files changed, 12 insertions(+), 29 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e585514..886cf38 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -164,31 +164,30 @@ #[cfg(feature = "real_blackbox")] extern crate test; -pub use peakmem_alloc::*; - -pub(crate) mod bench; -/// Ids for benchmarks -pub mod bench_id; -pub(crate) mod bench_runner; -pub(crate) mod output_value; /// The module to define custom plugins pub mod plugins; -pub use output_value::OutputValue; /// The module to report benchmark results pub mod report; + +pub(crate) mod bench; +pub(crate) mod bench_id; +pub(crate) mod bench_runner; +pub(crate) mod output_value; pub(crate) mod stats; pub(crate) mod write_results; -pub use bench::BenchResult; - mod bench_group; mod bench_input_group; mod config; +pub use bench::BenchResult; pub use bench_group::BenchGroup; +pub use bench_id::BenchId; pub use bench_input_group::InputGroup; pub use bench_runner::BenchRunner; pub use config::Config; +pub use output_value::OutputValue; +pub use peakmem_alloc::*; pub(crate) use config::parse_args; diff --git a/src/report/mod.rs b/src/report/mod.rs index a563cb2..0456a4a 100644 --- a/src/report/mod.rs +++ b/src/report/mod.rs @@ -28,17 +28,11 @@ use crate::{ }; /// The trait for reporting the results of a benchmark run. -pub trait Reporter: ReporterClone { +pub trait Reporter { /// Report the results from a group (can be a single bench) fn report_results(&self, results: Vec, output_value_column_title: &'static str); } -/// The trait to enable cloning on the Box reporter -pub trait ReporterClone { - /// Clone the box - fn clone_box(&self) -> Box; -} - pub(crate) fn report_group<'a>( runner_name: Option<&str>, group_name: Option<&str>, diff --git a/src/report/plain_reporter.rs b/src/report/plain_reporter.rs index 44403cf..982f87c 100644 --- a/src/report/plain_reporter.rs +++ b/src/report/plain_reporter.rs @@ -1,6 +1,6 @@ use yansi::Paint; -use super::{avg_median_str, memory_str, min_max_str, BenchStats, Reporter, ReporterClone}; +use super::{avg_median_str, memory_str, min_max_str, BenchStats, Reporter}; use crate::bench::BenchResult; #[derive(Clone, Copy)] @@ -13,11 +13,6 @@ use crate::bench::BenchResult; /// factorial 400 Avg: 107ns Median: 107ns [107ns .. 109ns] /// ``` pub struct PlainReporter {} -impl ReporterClone for PlainReporter { - fn clone_box(&self) -> Box { - Box::new(*self) - } -} impl Reporter for PlainReporter { fn report_results(&self, results: Vec, output_value_column_title: &'static str) { diff --git a/src/report/table_reporter.rs b/src/report/table_reporter.rs index 32403ab..cdf63e5 100644 --- a/src/report/table_reporter.rs +++ b/src/report/table_reporter.rs @@ -1,4 +1,4 @@ -use super::{avg_median_str, memory_str, min_max_str, Reporter, ReporterClone}; +use super::{avg_median_str, memory_str, min_max_str, Reporter}; use crate::bench::BenchResult; #[derive(Clone, Copy)] @@ -15,11 +15,6 @@ use crate::bench::BenchResult; /// | hashmap | Memory: 84 B | 840.24 MiB/s (+1.54%) | 841.17 MiB/s (+0.33%) | [843.96 MiB/s .. 817.73 MiB/s] | /// ``` pub struct TableReporter; -impl ReporterClone for TableReporter { - fn clone_box(&self) -> Box { - Box::new(*self) - } -} impl Reporter for TableReporter { fn report_results(&self, results: Vec, output_value_column_title: &'static str) { use prettytable::*;