aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAria Shrimpton <me@aria.rip>2024-03-31 18:33:29 +0100
committerAria Shrimpton <me@aria.rip>2024-03-31 18:33:29 +0100
commit89c3e04eb22b67dfa21199c8a76d4ecc953fe6d7 (patch)
treee534663fcac7034041fca88e226c9a6bcb6790e0 /src
parent0260147246507960bb86fa088eb986bc773dd824 (diff)
some code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/crates/candelabra/src/cache.rs3
-rw-r--r--src/crates/candelabra/src/cost/benchmark.rs2
-rw-r--r--src/crates/candelabra/src/cost/mod.rs2
-rw-r--r--src/crates/candelabra/src/lib.rs2
-rw-r--r--src/crates/candelabra/src/profiler/info.rs1
-rw-r--r--src/crates/library/src/btreemap.rs5
-rw-r--r--src/crates/library/src/hashmap.rs5
-rw-r--r--src/crates/library/src/sortedvecmap.rs5
-rw-r--r--src/crates/library/src/vecmap.rs5
-rw-r--r--src/crates/primrose/src/bounded_ops.rs1
-rw-r--r--src/crates/primrose/src/description.rs4
-rw-r--r--src/crates/primrose/src/type_check.rs2
-rw-r--r--src/tests/aoc_2021_09/src/lib.rs2
13 files changed, 6 insertions, 33 deletions
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<K: ?Sized + ToString, V: Serialize + for<'a> Deserialize<'a>> FileCache<K,
if san.is_empty() {
san += "_";
}
- self.base_dir.join(san) // TODO: santisation
+ self.base_dir.join(san)
}
}
/// Generate a hash from the current state of the given directory
/// This is built from the modification time of all files in that directory and all children.
pub fn gen_tree_hash(dir: &Utf8Path) -> Result<u64> {
- // 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<Cost> {
"µ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<K: Ord + Hash, V> Mapping<K, V> for BTreeMap<K, V> {
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<K: Ord + Hash, V> Mapping<K, V> for HashMap<K, V> {
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<K, V> IntoIterator for SortedVecMap<K, V> {
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<K, V> IntoIterator for VecMap<K, V> {
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<ElemTypeName>), Vec<Description>),
- /// 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<ElemTypeName>,
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<T> = VecDeque<T>; // TODO: would be nice for this to be in primrose
+type Queue<T> = VecDeque<T>;
pub struct HeightMap {
map: Map<(usize, usize), usize>,