From 84cc19c64e8a8bd0cbc16c0d30c6739f3c7edabb Mon Sep 17 00:00:00 2001 From: Kariy Date: Thu, 26 Oct 2023 18:13:22 +0900 Subject: [PATCH] rebase main --- crates/dojo-lang/src/compiler.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/dojo-lang/src/compiler.rs b/crates/dojo-lang/src/compiler.rs index c98ae96d84..5834a0fd17 100644 --- a/crates/dojo-lang/src/compiler.rs +++ b/crates/dojo-lang/src/compiler.rs @@ -104,18 +104,20 @@ impl Compiler for DojoCompiler { let contract_name = decl.submodule_id.name(db.upcast_mut()); let contract_name_snake = contract_name.to_case(Case::Snake); - let is_model = match class.abi.clone() { - Some(abii) => abii.items.iter().any(|i| match i { + let is_model = match &class.abi { + Some(abi) => abi.items.iter().any(|i| match i { abi::Item::Struct(s) => s.name == "dojo::database::schema::Struct", _ => false, }), + None => false, }; let separator = if is_model { "model" } else { "contract" }; let file_name = format!("{target_name}-{separator}-{contract_name_snake}.json"); - let mut file = target_dir.open_rw(file_name.clone(), "output file", ws.config())?; + let mut file = + target_dir.open_rw(contract_name_snake.clone(), "output file", ws.config())?; serde_json::to_writer_pretty(file.deref_mut(), &class) .with_context(|| format!("failed to serialize contract: {contract_name}"))?;