1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-11-08 09:09:17 +01:00

Add deny_unknown_fields

This commit is contained in:
mo8it 2024-04-10 14:40:49 +02:00
parent b3642b0219
commit 27e9520665
2 changed files with 3 additions and 0 deletions

@ -46,6 +46,7 @@ pub enum Mode {
} }
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct InfoFile { pub struct InfoFile {
pub exercises: Vec<Exercise>, pub exercises: Vec<Exercise>,
} }
@ -65,6 +66,7 @@ impl InfoFile {
// Deserialized from the `info.toml` file. // Deserialized from the `info.toml` file.
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Exercise { pub struct Exercise {
// Name of the exercise // Name of the exercise
pub name: String, pub name: String,

@ -5,6 +5,7 @@ use std::fs;
use crate::exercise::Exercise; use crate::exercise::Exercise;
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct StateFile { pub struct StateFile {
next_exercise_ind: usize, next_exercise_ind: usize,
progress: Vec<bool>, progress: Vec<bool>,