1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-07-05 00:48:47 +02:00

Deal with long strings

This commit is contained in:
mo8it
2024-04-12 01:24:01 +02:00
parent 1e3745ccdf
commit 2a95a3e966
6 changed files with 114 additions and 104 deletions

View File

@ -24,6 +24,10 @@ pub enum Mode {
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct InfoFile {
// TODO
pub welcome_message: Option<String>,
// TODO
pub final_message: Option<String>,
pub exercises: Vec<Exercise>,
}
@ -39,10 +43,7 @@ impl InfoFile {
.context("Failed to parse `info.toml`")?;
if slf.exercises.is_empty() {
panic!(
"There are no exercises yet!
If you are developing third-party exercises, add at least one exercise before testing."
);
panic!("{NO_EXERCISES_ERR}");
}
Ok(slf)
@ -119,3 +120,6 @@ impl Display for Exercise {
self.path.fmt(f)
}
}
const NO_EXERCISES_ERR: &str = "There are no exercises yet!
If you are developing third-party exercises, add at least one exercise before testing.";