From b3aedfb4119e41f619d8264e09c9efb6d043dd0d Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 25 Aug 2024 17:27:31 +0200 Subject: [PATCH] chore: fix warnings Signed-off-by: kjuulh --- crates/cuddle/src/main.rs | 4 ++-- crates/cuddle/src/plan.rs | 25 -------------------- crates/cuddle/src/project.rs | 3 +-- crates/cuddle/src/schema_validator.rs | 1 - crates/cuddle/src/state/validated_project.rs | 8 +------ 5 files changed, 4 insertions(+), 37 deletions(-) diff --git a/crates/cuddle/src/main.rs b/crates/cuddle/src/main.rs index c253b38..167ab4a 100644 --- a/crates/cuddle/src/main.rs +++ b/crates/cuddle/src/main.rs @@ -79,7 +79,7 @@ impl Cli { } async fn add_project_commands(self) -> anyhow::Result { - if let Some(project) = self.cuddle.state.project.as_ref() { + if let Some(_project) = self.cuddle.state.project.as_ref() { // Add project level commands } @@ -87,7 +87,7 @@ impl Cli { } async fn add_plan_commands(self) -> anyhow::Result { - if let Some(plan) = self.cuddle.state.plan.as_ref() { + if let Some(_plan) = self.cuddle.state.plan.as_ref() { // Add plan level commands } diff --git a/crates/cuddle/src/plan.rs b/crates/cuddle/src/plan.rs index f00e1d5..1102efc 100644 --- a/crates/cuddle/src/plan.rs +++ b/crates/cuddle/src/plan.rs @@ -71,7 +71,6 @@ pub struct RawPlanConfigSection { #[serde(untagged)] pub enum RawPlanSchema { Nickel { nickel: PathBuf }, - JsonSchema { jsonschema: String }, } pub struct Plan {} @@ -200,28 +199,4 @@ mod tests { Ok(()) } - - #[test] - fn test_can_parse_json_schema() -> anyhow::Result<()> { - let plan = RawPlan::from_file( - r##" - [plan] - schema = {jsonschema = "schema.json"} - "##, - &PathBuf::new(), - )?; - - assert_eq!( - RawPlanConfig { - plan: RawPlanConfigSection { - schema: Some(RawPlanSchema::JsonSchema { - jsonschema: "schema.json".into() - }), - } - }, - plan.config, - ); - - Ok(()) - } } diff --git a/crates/cuddle/src/project.rs b/crates/cuddle/src/project.rs index 1c2ed76..ac9cf7f 100644 --- a/crates/cuddle/src/project.rs +++ b/crates/cuddle/src/project.rs @@ -7,9 +7,8 @@ use serde::Deserialize; pub const CUDDLE_PROJECT_FILE: &str = "cuddle.toml"; -#[derive(Clone)] pub struct RawProject { - config: RawConfig, + pub config: RawConfig, pub root: PathBuf, } diff --git a/crates/cuddle/src/schema_validator.rs b/crates/cuddle/src/schema_validator.rs index 93c8eb7..e486d89 100644 --- a/crates/cuddle/src/schema_validator.rs +++ b/crates/cuddle/src/schema_validator.rs @@ -24,7 +24,6 @@ impl SchemaValidator { RawPlanSchema::Nickel { nickel } => Ok(Some(NickelSchemaValidator::validate( plan, project, nickel, )?)), - RawPlanSchema::JsonSchema { jsonschema } => todo!("jsonschema not implemented yet"), } } } diff --git a/crates/cuddle/src/state/validated_project.rs b/crates/cuddle/src/state/validated_project.rs index a05b6e2..fa8892f 100644 --- a/crates/cuddle/src/state/validated_project.rs +++ b/crates/cuddle/src/state/validated_project.rs @@ -9,7 +9,7 @@ use toml::Table; use crate::project::CUDDLE_PROJECT_FILE; pub struct Project { - value: Value, + pub value: Value, pub root: PathBuf, } @@ -23,7 +23,6 @@ impl Project { pub fn from_file(content: &str, root: &Path) -> anyhow::Result { let table: Table = toml::from_str(content)?; - let config = Config::default(); let project = table .get("project") @@ -47,11 +46,6 @@ impl Project { } } -#[derive(Default)] -struct Config { - project: BTreeMap, -} - pub enum Value { String(String), Bool(bool),