Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtbuilds committed Sep 15, 2024
1 parent 752d418 commit 20d180b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions libninja/src/rust/codegen/ty.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use proc_macro2::TokenStream;
use quote::quote;

use hir::HirSpec;
use mir::Ty;
use proc_macro2::TokenStream;
use quote::quote;

use crate::rust::codegen::ToRustIdent;
use crate::rust::lower_hir::HirFieldExt;
Expand Down Expand Up @@ -85,7 +84,7 @@ impl ToRustType for Ty {
Ty::Array(_) => true,
Ty::Model(name) => {
let model = spec.get_record(name.as_str()).expect("Model not found");
model.fields().all(|f| f.implements_default(spec))
model.fields().count() > 0 && model.fields().all(|f| f.implements_default(spec))
}
Ty::Unit => true,
Ty::Any(_) => true,
Expand Down
2 changes: 1 addition & 1 deletion mir_rust/src/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn lower_enum(e: &hir::Enum, derives: &[String]) -> Enum<TokenStream, RustEx
})
.collect();
let derives = derives_to_tokens(derives);
let derives = quote! { #[derive(Debug, Serialize, Deserialize #derives)] };
let derives = quote! { #[derive(Debug, Serialize, Deserialize, Clone #derives)] };
Enum {
name: e.name.to_rust_struct(),
doc: e.doc.clone(),
Expand Down

0 comments on commit 20d180b

Please sign in to comment.