diff --git a/frb_codegen/src/library/codegen/parser/hir/tree/parser/crates.rs b/frb_codegen/src/library/codegen/parser/hir/tree/parser/crates.rs index 1553bc9c43..205d58dda2 100644 --- a/frb_codegen/src/library/codegen/parser/hir/tree/parser/crates.rs +++ b/frb_codegen/src/library/codegen/parser/hir/tree/parser/crates.rs @@ -15,7 +15,7 @@ pub(crate) fn parse_crate( vis: HirVisibility::Public, namespace: crate_name.namespace(), }; - let root_module = parse_module(file.items, info, config)?; + let root_module = parse_module(file.items, info, config)?.unwrap(); Ok(HirTreeCrate { name: crate_name.to_owned(), root_module, diff --git a/frb_codegen/src/library/codegen/parser/hir/tree/parser/module.rs b/frb_codegen/src/library/codegen/parser/hir/tree/parser/module.rs index 8a38203522..e5ffe63b62 100644 --- a/frb_codegen/src/library/codegen/parser/hir/tree/parser/module.rs +++ b/frb_codegen/src/library/codegen/parser/hir/tree/parser/module.rs @@ -8,7 +8,7 @@ pub(super) fn parse_module( items: Vec, meta: HirTreeModuleMeta, config: &ParserHirInternalConfig, -) -> anyhow::Result { +) -> anyhow::Result> { let mut output_items = vec![]; let mut output_modules = vec![]; @@ -24,11 +24,11 @@ pub(super) fn parse_module( } } - Ok(HirTreeModule { + Ok(Some(HirTreeModule { meta, items: output_items, modules: output_modules, - }) + })) } fn parse_syn_item_mod( @@ -43,7 +43,7 @@ fn parse_syn_item_mod( vis: (&item_mod.vis).into(), namespace: namespace.join(&item_mod.ident.to_string()), }; - Some(parse_module(items, info, config)?) + parse_module(items, info, config)? } else { None })