aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAria Shrimpton <me@aria.rip>2024-03-04 14:00:06 +0000
committerAria Shrimpton <me@aria.rip>2024-03-04 14:00:06 +0000
commit7e25cf0c0d50e7606378a8ef91d66df8a979b1f7 (patch)
tree62b50cd23ae0d37d67cd3b875c42c5b10002a1fa
parent239810773e3f7cde2d5acd3d0b3ab86ed1440d54 (diff)
fix lints
-rw-r--r--src/crates/benchmarker/src/container.rs2
-rw-r--r--src/crates/benchmarker/src/lib.rs1
-rw-r--r--src/crates/benchmarker/src/mapping.rs2
-rw-r--r--src/crates/benchmarker/src/stack.rs4
-rw-r--r--src/crates/candelabra/src/confirmation.rs2
-rw-r--r--src/crates/candelabra/src/cost/benchmark.rs4
-rw-r--r--src/crates/cli/src/select.rs4
-rw-r--r--src/crates/library/src/hashset.rs1
-rw-r--r--src/crates/library/src/list.rs1
-rw-r--r--src/crates/library/src/treeset.rs1
-rw-r--r--src/crates/library/src/vector.rs1
-rw-r--r--src/crates/primrose/src/codegen.rs2
-rw-r--r--src/crates/primrose/src/library_specs.rs2
-rw-r--r--src/crates/primrose/src/parser.rs25
14 files changed, 24 insertions, 28 deletions
diff --git a/src/crates/benchmarker/src/container.rs b/src/crates/benchmarker/src/container.rs
index 470d3b3..4e7b12c 100644
--- a/src/crates/benchmarker/src/container.rs
+++ b/src/crates/benchmarker/src/container.rs
@@ -33,7 +33,7 @@ where
);
// Since we've repeated n times in each run
- results.iter_mut().for_each(|t| *t = *t / n as f64);
+ results.iter_mut().for_each(|t| *t /= n as f64);
print_results("insert", n, &results);
}
diff --git a/src/crates/benchmarker/src/lib.rs b/src/crates/benchmarker/src/lib.rs
index 1a7d519..6e5614c 100644
--- a/src/crates/benchmarker/src/lib.rs
+++ b/src/crates/benchmarker/src/lib.rs
@@ -16,7 +16,6 @@ pub use mapping::*;
pub use stack::*;
const WARM_UP_TIME: Duration = Duration::from_millis(500);
-const MEASUREMENT_TIME: Duration = Duration::from_secs(1);
pub type BenchmarkResult = f64;
diff --git a/src/crates/benchmarker/src/mapping.rs b/src/crates/benchmarker/src/mapping.rs
index 4b29a27..9c3d467 100644
--- a/src/crates/benchmarker/src/mapping.rs
+++ b/src/crates/benchmarker/src/mapping.rs
@@ -46,7 +46,7 @@ where
);
// Since we've repeated n times in each run
- results.iter_mut().for_each(|t| *t = *t / n as f64);
+ results.iter_mut().for_each(|t| *t /= n as f64);
print_results("insert", n, &results);
}
diff --git a/src/crates/benchmarker/src/stack.rs b/src/crates/benchmarker/src/stack.rs
index 58fe6f2..94c1bff 100644
--- a/src/crates/benchmarker/src/stack.rs
+++ b/src/crates/benchmarker/src/stack.rs
@@ -33,7 +33,7 @@ where
);
// Since we've repeated n times in each run
- results.iter_mut().for_each(|t| *t = *t / n as f64);
+ results.iter_mut().for_each(|t| *t /= n as f64);
print_results("push", n, &results);
}
@@ -60,7 +60,7 @@ where
);
// Since we've repeated n times in each run
- results.iter_mut().for_each(|t| *t = *t / n as f64);
+ results.iter_mut().for_each(|t| *t /= n as f64);
print_results("pop", n, &results);
}
diff --git a/src/crates/candelabra/src/confirmation.rs b/src/crates/candelabra/src/confirmation.rs
index c255628..88bc190 100644
--- a/src/crates/candelabra/src/confirmation.rs
+++ b/src/crates/candelabra/src/confirmation.rs
@@ -31,7 +31,7 @@ impl State {
self.save_choices(proj, selections)
.context("error setting up project")?;
- self.run_benchmarks(proj, &format!("{:?}", selections).replace("/", "-"))
+ self.run_benchmarks(proj, &format!("{:?}", selections).replace('/', "-"))
.context("error running benchmarks")
}
diff --git a/src/crates/candelabra/src/cost/benchmark.rs b/src/crates/candelabra/src/cost/benchmark.rs
index 7bb75ae..2997c9e 100644
--- a/src/crates/candelabra/src/cost/benchmark.rs
+++ b/src/crates/candelabra/src/cost/benchmark.rs
@@ -11,7 +11,7 @@ use std::{
};
use anyhow::{bail, Context, Result};
-use log::{debug, info, log_enabled, Level};
+use log::{info, log_enabled, Level};
use primrose::{LibSpec, LibSpecs};
use serde::{Deserialize, Serialize};
use tempfile::{tempdir, TempDir};
@@ -83,7 +83,7 @@ pub fn run_benchmarks(name: &str, paths: &Paths, lib_specs: &LibSpecs) -> Result
for (op, n, result) in measurements {
by_op
.entry(op.to_string())
- .and_modify(|v: &mut Vec<(usize, BenchmarkResult)>| v.push((n, result.clone())))
+ .and_modify(|v: &mut Vec<(usize, BenchmarkResult)>| v.push((n, result)))
.or_insert(vec![(n, result)]);
}
diff --git a/src/crates/cli/src/select.rs b/src/crates/cli/src/select.rs
index 9785c75..60285b8 100644
--- a/src/crates/cli/src/select.rs
+++ b/src/crates/cli/src/select.rs
@@ -5,7 +5,7 @@ use argh::FromArgs;
use cargo_metadata::camino::Utf8PathBuf;
use log::info;
use primrose::{tools::nary_cartesian_product, ConTypeName, ContainerSelection};
-use tabled::{builder::Builder, settings::Style};
+use tabled::builder::Builder;
use crate::State;
@@ -51,7 +51,7 @@ impl State {
// 'brute force' and time all possibilities
let candidates = costs
.iter()
- .map(|(f, ctn, cs)| ((f, ctn), cs.into_iter().map(|(i, _)| i.clone()).collect()))
+ .map(|(f, ctn, cs)| ((f, ctn), cs.iter().map(|(i, _)| i.clone()).collect()))
.collect::<HashMap<(&Utf8PathBuf, &ConTypeName), Vec<ContainerSelection>>>();
let possible_assignments = nary_cartesian_product(&candidates);
diff --git a/src/crates/library/src/hashset.rs b/src/crates/library/src/hashset.rs
index 9c52049..87f8f87 100644
--- a/src/crates/library/src/hashset.rs
+++ b/src/crates/library/src/hashset.rs
@@ -91,6 +91,7 @@ impl<T: Ord + Hash> Container<T> for HashSet<T> {
}
}
+ #[allow(clippy::into_iter_on_ref, clippy::needless_borrow)]
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a T>
where
T: 'a,
diff --git a/src/crates/library/src/list.rs b/src/crates/library/src/list.rs
index 061f1b4..55cc651 100644
--- a/src/crates/library/src/list.rs
+++ b/src/crates/library/src/list.rs
@@ -101,6 +101,7 @@ impl<T: Ord> Container<T> for LinkedList<T> {
}
}
+ #[allow(clippy::into_iter_on_ref, clippy::needless_borrow)]
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a T>
where
T: 'a,
diff --git a/src/crates/library/src/treeset.rs b/src/crates/library/src/treeset.rs
index ad3b60d..84e8893 100644
--- a/src/crates/library/src/treeset.rs
+++ b/src/crates/library/src/treeset.rs
@@ -90,6 +90,7 @@ impl<T: Ord> Container<T> for BTreeSet<T> {
}
}
+ #[allow(clippy::into_iter_on_ref, clippy::needless_borrow)]
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a T>
where
T: 'a,
diff --git a/src/crates/library/src/vector.rs b/src/crates/library/src/vector.rs
index 19d0179..5b02e89 100644
--- a/src/crates/library/src/vector.rs
+++ b/src/crates/library/src/vector.rs
@@ -88,6 +88,7 @@ impl<T: PartialEq> Container<T> for Vec<T> {
Some(Vec::remove(self, idx))
}
+ #[allow(clippy::into_iter_on_ref, clippy::needless_borrow)]
fn iter<'a>(&'a self) -> impl Iterator<Item = &'a T>
where
T: 'a,
diff --git a/src/crates/primrose/src/codegen.rs b/src/crates/primrose/src/codegen.rs
index bf26c8f..82887bb 100644
--- a/src/crates/primrose/src/codegen.rs
+++ b/src/crates/primrose/src/codegen.rs
@@ -137,7 +137,7 @@ fn _{tag_id}<{bounds}>() -> {tag_id}<{vars}> {{
threshold,
after,
} => {
- let adaptive_container_type = if vars.contains(",") {
+ let adaptive_container_type = if vars.contains(',') {
"AdaptiveMappingContainer"
} else {
"AdaptiveContainer"
diff --git a/src/crates/primrose/src/library_specs.rs b/src/crates/primrose/src/library_specs.rs
index 3552d36..c9f90bb 100644
--- a/src/crates/primrose/src/library_specs.rs
+++ b/src/crates/primrose/src/library_specs.rs
@@ -66,7 +66,7 @@ impl LibSpec {
Ok(spec) => {
lib_specs.insert(spec.struct_name.clone(), spec);
}
- Err(e) => {
+ Err(_) => {
debug!("Ignoring invalid library module {}", &path);
}
}
diff --git a/src/crates/primrose/src/parser.rs b/src/crates/primrose/src/parser.rs
index 96720c5..4892722 100644
--- a/src/crates/primrose/src/parser.rs
+++ b/src/crates/primrose/src/parser.rs
@@ -33,22 +33,15 @@ impl Term {
}
pub fn require_cdr(&self) -> bool {
- match self {
- Term::Var(id)
- if id == "op-pop"
- || id == "op-len"
- || id == "op-contains"
- || id == "op-is-empty"
- || id == "op-remove"
- || id == "op-first"
- || id == "op-last"
- || id == "op-nth"
- || id == "op-get" =>
- {
- true
- }
- _ => false,
- }
+ matches!(self, Term::Var(id) if id == "op-pop"
+ || id == "op-len"
+ || id == "op-contains"
+ || id == "op-is-empty"
+ || id == "op-remove"
+ || id == "op-first"
+ || id == "op-last"
+ || id == "op-nth"
+ || id == "op-get")
}
}