diff options
Diffstat (limited to 'src/info_file.rs')
| -rw-r--r-- | src/info_file.rs | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/src/info_file.rs b/src/info_file.rs index d4e4611..fdc8f0f 100644 --- a/src/info_file.rs +++ b/src/info_file.rs @@ -52,30 +52,6 @@ impl ExerciseInfo { path } - - /// Path to the solution file starting with the `solutions/` directory. - pub fn sol_path(&self) -> String { - let mut path = if let Some(dir) = &self.dir { - // 14 = 10 + 1 + 3 - // solutions/ + / + .rs - let mut path = String::with_capacity(14 + dir.len() + self.name.len()); - path.push_str("solutions/"); - path.push_str(dir); - path.push('/'); - path - } else { - // 13 = 10 + 3 - // solutions/ + .rs - let mut path = String::with_capacity(13 + self.name.len()); - path.push_str("solutions/"); - path - }; - - path.push_str(&self.name); - path.push_str(".rs"); - - path - } } impl RunnableExercise for ExerciseInfo { @@ -85,6 +61,11 @@ impl RunnableExercise for ExerciseInfo { } #[inline] + fn dir(&self) -> Option<&str> { + self.dir.as_deref() + } + + #[inline] fn strict_clippy(&self) -> bool { self.strict_clippy } |
