From 89c3e04eb22b67dfa21199c8a76d4ecc953fe6d7 Mon Sep 17 00:00:00 2001 From: Aria Shrimpton Date: Sun, 31 Mar 2024 18:33:29 +0100 Subject: some code cleanup --- src/crates/candelabra/src/cache.rs | 3 +-- src/crates/candelabra/src/cost/benchmark.rs | 2 +- src/crates/candelabra/src/cost/mod.rs | 2 -- src/crates/candelabra/src/lib.rs | 2 +- src/crates/candelabra/src/profiler/info.rs | 1 - src/crates/library/src/btreemap.rs | 5 ----- src/crates/library/src/hashmap.rs | 5 ----- src/crates/library/src/sortedvecmap.rs | 5 ----- src/crates/library/src/vecmap.rs | 5 ----- src/crates/primrose/src/bounded_ops.rs | 1 - src/crates/primrose/src/description.rs | 4 ++-- src/crates/primrose/src/type_check.rs | 2 -- src/tests/aoc_2021_09/src/lib.rs | 2 +- 13 files changed, 6 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/crates/candelabra/src/cache.rs b/src/crates/candelabra/src/cache.rs index 786cdda..7d74e5d 100644 --- a/src/crates/candelabra/src/cache.rs +++ b/src/crates/candelabra/src/cache.rs @@ -111,14 +111,13 @@ impl Deserialize<'a>> FileCache Result { - // TODO: ignore target, etc let mut hasher = DefaultHasher::new(); let mut files = glob(&format!("{}/**/*", dir)) diff --git a/src/crates/candelabra/src/cost/benchmark.rs b/src/crates/candelabra/src/cost/benchmark.rs index 74573a6..bf8606b 100644 --- a/src/crates/candelabra/src/cost/benchmark.rs +++ b/src/crates/candelabra/src/cost/benchmark.rs @@ -156,7 +156,7 @@ fn parse_time_str(quantity: &str, suffix: &str) -> Option { "µs" => 1e3, "ns" => 1.0, "ps" => 1e-3, - s => todo!("unrecognised suffix {}", s), + s => unimplemented!("unrecognised suffix {}", s), }, ) } diff --git a/src/crates/candelabra/src/cost/mod.rs b/src/crates/candelabra/src/cost/mod.rs index bbe4942..4fd06bc 100644 --- a/src/crates/candelabra/src/cost/mod.rs +++ b/src/crates/candelabra/src/cost/mod.rs @@ -54,13 +54,11 @@ impl ResultsStore { let lib_specs = LibSpec::read_all(paths.library_src.as_std_path()).map_err(|e| anyhow!("{}", e))?; - // TODO: this should be home folder or smth let base_dir = paths .target_dir .join("candelabra") .join("benchmark_results"); - // TODO: Doesn't take NS or ELEM_TYPE into account let lib_hash = gen_tree_hash(&paths.library_crate).context("Error generating library hash")?; diff --git a/src/crates/candelabra/src/lib.rs b/src/crates/candelabra/src/lib.rs index 3a38265..6fdcdf5 100644 --- a/src/crates/candelabra/src/lib.rs +++ b/src/crates/candelabra/src/lib.rs @@ -45,7 +45,7 @@ impl State { results: ResultsStore::new(&paths)?, profiler_info_cache: Self::usage_profile_cache(&paths)?, - model_size: 3, // TODO + model_size: 3, // This could be made customisable in future paths, }) } diff --git a/src/crates/candelabra/src/profiler/info.rs b/src/crates/candelabra/src/profiler/info.rs index 6f24ba7..6e63598 100644 --- a/src/crates/candelabra/src/profiler/info.rs +++ b/src/crates/candelabra/src/profiler/info.rs @@ -84,7 +84,6 @@ impl UsageProfile { let split_idx = top_by_partition .iter() .enumerate() - // TODO: fudge? .find(|(idx, (best, _))| *idx > 0 && *best != top_by_partition[idx - 1].0) .map(|(idx, _)| idx)?; diff --git a/src/crates/library/src/btreemap.rs b/src/crates/library/src/btreemap.rs index 5e6891b..c3e26c6 100644 --- a/src/crates/library/src/btreemap.rs +++ b/src/crates/library/src/btreemap.rs @@ -93,8 +93,3 @@ impl Mapping for BTreeMap { BTreeMap::iter(self) } } - -#[cfg(test)] -mod tests { - // TODO -} diff --git a/src/crates/library/src/hashmap.rs b/src/crates/library/src/hashmap.rs index a841297..0676b24 100644 --- a/src/crates/library/src/hashmap.rs +++ b/src/crates/library/src/hashmap.rs @@ -93,8 +93,3 @@ impl Mapping for HashMap { HashMap::iter(self) } } - -#[cfg(test)] -mod tests { - // TODO -} diff --git a/src/crates/library/src/sortedvecmap.rs b/src/crates/library/src/sortedvecmap.rs index 6791ad5..157234b 100644 --- a/src/crates/library/src/sortedvecmap.rs +++ b/src/crates/library/src/sortedvecmap.rs @@ -132,8 +132,3 @@ impl IntoIterator for SortedVecMap { self.v.into_iter() } } - -#[cfg(test)] -mod tests { - // TODO -} diff --git a/src/crates/library/src/vecmap.rs b/src/crates/library/src/vecmap.rs index 0b631f6..101ba32 100644 --- a/src/crates/library/src/vecmap.rs +++ b/src/crates/library/src/vecmap.rs @@ -136,8 +136,3 @@ impl IntoIterator for VecMap { self.v.into_iter() } } - -#[cfg(test)] -mod tests { - // TODO -} diff --git a/src/crates/primrose/src/bounded_ops.rs b/src/crates/primrose/src/bounded_ops.rs index 6e91eeb..cbd0d19 100644 --- a/src/crates/primrose/src/bounded_ops.rs +++ b/src/crates/primrose/src/bounded_ops.rs @@ -143,7 +143,6 @@ pub fn generate_bounded_ops() -> BoundedOps { ], ); - // TODO: Container operations let container_ty = Type::Con( "Con".to_string(), vec![TypeVar::new("T").into()], diff --git a/src/crates/primrose/src/description.rs b/src/crates/primrose/src/description.rs index 7b1c715..7849448 100644 --- a/src/crates/primrose/src/description.rs +++ b/src/crates/primrose/src/description.rs @@ -12,9 +12,9 @@ type BoundName = String; pub enum Tag { /// Links to a property by name Prop(Description), - /// TODO + /// Places a bound on a container type. Bound((ConName, Vec), Vec), - /// Places bounds on a container type defined in the type context + /// Defines a container type Con( /// The name of the type variable used for the element type Vec, diff --git a/src/crates/primrose/src/type_check.rs b/src/crates/primrose/src/type_check.rs index b601ced..a070f45 100644 --- a/src/crates/primrose/src/type_check.rs +++ b/src/crates/primrose/src/type_check.rs @@ -242,8 +242,6 @@ impl TypeChecker { if self.global_ctx.get(&i.to_string()).is_some() { return Err(TypeError("Duplicate bound name declaration".to_string())); } - - // TODO: check each bound is a valid rust trait } Ok(()) } diff --git a/src/tests/aoc_2021_09/src/lib.rs b/src/tests/aoc_2021_09/src/lib.rs index 9ada752..6583fba 100644 --- a/src/tests/aoc_2021_09/src/lib.rs +++ b/src/tests/aoc_2021_09/src/lib.rs @@ -7,7 +7,7 @@ use std::collections::VecDeque; mod types; use types::*; -type Queue = VecDeque; // TODO: would be nice for this to be in primrose +type Queue = VecDeque; pub struct HeightMap { map: Map<(usize, usize), usize>, -- cgit v1.2.3