aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAria <me@aria.rip>2023-10-31 16:09:59 +0000
committerAria <me@aria.rip>2023-10-31 16:09:59 +0000
commit23dcf32d4a95cc6357ca6081c0927c6d02582334 (patch)
tree9c10d1ad92ce8a62ddc02f0d1647f934687af6aa
parentf7a3521c740479eb9a415eaec31f412522bc1917 (diff)
style(all): fix clippy lints
-rw-r--r--primrose/crates/candelabra-benchmarker/src/bench.rs4
-rw-r--r--primrose/crates/candelabra-benchmarker/src/indexable.rs2
-rw-r--r--primrose/crates/candelabra-benchmarker/src/lib.rs2
-rw-r--r--primrose/crates/candelabra-benchmarker/src/stack.rs2
-rw-r--r--primrose/crates/candelabra-cli/src/project.rs8
5 files changed, 9 insertions, 9 deletions
diff --git a/primrose/crates/candelabra-benchmarker/src/bench.rs b/primrose/crates/candelabra-benchmarker/src/bench.rs
index c2c8bea..161099a 100644
--- a/primrose/crates/candelabra-benchmarker/src/bench.rs
+++ b/primrose/crates/candelabra-benchmarker/src/bench.rs
@@ -17,7 +17,8 @@ pub fn benchmark_op<T>(
mut op: impl FnMut(&mut T),
mut undo: impl FnMut(&mut T),
) -> RunResults {
- let loop_end = Instant::now() + Duration::from_secs(5);
+ // let loop_end = Instant::now() + Duration::from_secs(5);
+ let loop_end = Instant::now() + Duration::from_millis(100);
let mut times = 0;
let mut min = Duration::from_secs(u64::MAX);
@@ -26,6 +27,7 @@ pub fn benchmark_op<T>(
let mut target = setup();
while Instant::now() + max < loop_end {
+ #[allow(clippy::unit_arg)] // pretty sure this is necessary to prevent optimisations
let duration = time_singular(|| black_box(op(&mut target)));
undo(&mut target);
diff --git a/primrose/crates/candelabra-benchmarker/src/indexable.rs b/primrose/crates/candelabra-benchmarker/src/indexable.rs
index 915d093..7819ec5 100644
--- a/primrose/crates/candelabra-benchmarker/src/indexable.rs
+++ b/primrose/crates/candelabra-benchmarker/src/indexable.rs
@@ -4,7 +4,7 @@ use log::debug;
use primrose_library::traits::{Container, Indexable};
use rand::{distributions::Standard, prelude::Distribution, random};
-use crate::{benchmark_op, Results, RunResults, SingleNResults};
+use crate::{benchmark_op, RunResults, SingleNResults};
/// Benchmark [`primrose_library::traits::Indexable`] operations
pub trait IndexableExt<E> {
diff --git a/primrose/crates/candelabra-benchmarker/src/lib.rs b/primrose/crates/candelabra-benchmarker/src/lib.rs
index 3361048..abe8f0a 100644
--- a/primrose/crates/candelabra-benchmarker/src/lib.rs
+++ b/primrose/crates/candelabra-benchmarker/src/lib.rs
@@ -27,7 +27,7 @@ impl<T, E> Benchmarker<T, E> {
Results {
by_n: HashMap::new(),
},
- PhantomData::default(),
+ PhantomData,
)
}
diff --git a/primrose/crates/candelabra-benchmarker/src/stack.rs b/primrose/crates/candelabra-benchmarker/src/stack.rs
index f6b32f0..9deb852 100644
--- a/primrose/crates/candelabra-benchmarker/src/stack.rs
+++ b/primrose/crates/candelabra-benchmarker/src/stack.rs
@@ -4,7 +4,7 @@ use log::debug;
use primrose_library::traits::Stack;
use rand::{distributions::Standard, prelude::Distribution, random};
-use crate::{benchmark_op, Results, RunResults, SingleNResults};
+use crate::{benchmark_op, RunResults, SingleNResults};
/// Benchmark [`primrose_library::traits::Stack`] operations
pub trait StackExt<E> {
diff --git a/primrose/crates/candelabra-cli/src/project.rs b/primrose/crates/candelabra-cli/src/project.rs
index 70bc556..0424770 100644
--- a/primrose/crates/candelabra-cli/src/project.rs
+++ b/primrose/crates/candelabra-cli/src/project.rs
@@ -1,7 +1,7 @@
use std::{collections::HashMap, path::PathBuf};
use anyhow::{Context, Result};
-use cargo_metadata::{camino::Utf8PathBuf, Package, Target};
+use cargo_metadata::{camino::Utf8PathBuf, Package};
use glob::glob;
use primrose::ContainerSelector;
@@ -17,7 +17,6 @@ pub struct Project<'a> {
pub name: String,
source_dir: Utf8PathBuf,
- targets: Vec<Target>,
}
impl<'a> Project<'a> {
@@ -26,16 +25,15 @@ impl<'a> Project<'a> {
paths,
name: package.name.clone(),
source_dir: package.manifest_path.parent().unwrap().to_path_buf(),
- targets: package.targets,
}
}
/// Find all primrose files (`.pr.rs`) in this project.
pub fn find_primrose_files(&self) -> Result<Vec<PathBuf>> {
- Ok(glob(&format!("{}/**/*.pr.rs", self.source_dir))
+ glob(&format!("{}/**/*.pr.rs", self.source_dir))
.unwrap()
.collect::<Result<Vec<_>, _>>()
- .context("error finding primrose files in project")?)
+ .context("error finding primrose files in project")
}
/// Run primrose on all files in this project.