summaryrefslogtreecommitdiff
path: root/src/info_file.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-04-24 16:26:48 +0200
committermo8it <mo8it@proton.me>2024-04-24 16:26:48 +0200
commitd8c2ab8349854cbc7f4a994c7413d266cc38bc24 (patch)
tree438ee10bc209ee299d32e6e7c0f9c4310039bb11 /src/info_file.rs
parent0df0be835279a9dd176244b9014f459399153300 (diff)
Fix tests
Diffstat (limited to 'src/info_file.rs')
-rw-r--r--src/info_file.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/info_file.rs b/src/info_file.rs
index f344464..6938cd0 100644
--- a/src/info_file.rs
+++ b/src/info_file.rs
@@ -2,8 +2,6 @@ use anyhow::{bail, Context, Error, Result};
use serde::Deserialize;
use std::{fs, io::ErrorKind};
-use crate::DEBUG_PROFILE;
-
// The mode of the exercise.
#[derive(Deserialize, Copy, Clone)]
#[serde(rename_all = "lowercase")]
@@ -48,23 +46,15 @@ pub struct InfoFile {
}
impl InfoFile {
- fn from_embedded() -> Result<Self> {
- toml_edit::de::from_str(include_str!("../info.toml"))
- .context("Failed to parse the embedded `info.toml` file")
- }
-
pub fn parse() -> Result<Self> {
- if DEBUG_PROFILE {
- return Self::from_embedded();
- }
-
// Read a local `info.toml` if it exists.
let slf = match fs::read_to_string("info.toml") {
Ok(file_content) => toml_edit::de::from_str::<Self>(&file_content)
.context("Failed to parse the `info.toml` file")?,
Err(e) => {
if e.kind() == ErrorKind::NotFound {
- return Self::from_embedded();
+ return toml_edit::de::from_str(include_str!("../info.toml"))
+ .context("Failed to parse the embedded `info.toml` file");
}
return Err(Error::from(e).context("Failed to read the `info.toml` file"));