if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r)

This commit is contained in:
Maybe Waffle 2023-02-15 11:43:41 +00:00
parent 9b99a58301
commit f58bd0e290

View File

@ -248,17 +248,13 @@ fn reuse_workproduct_for_cgu(
dwarf_object: None, dwarf_object: None,
bytecode: None, bytecode: None,
}, },
module_global_asm: if has_global_asm { module_global_asm: has_global_asm.then(|| CompiledModule {
Some(CompiledModule { name: cgu.name().to_string(),
name: cgu.name().to_string(), kind: ModuleKind::Regular,
kind: ModuleKind::Regular, object: Some(obj_out_global_asm),
object: Some(obj_out_global_asm), dwarf_object: None,
dwarf_object: None, bytecode: None,
bytecode: None, }),
})
} else {
None
},
existing_work_product: Some((cgu.work_product_id(), work_product)), existing_work_product: Some((cgu.work_product_id(), work_product)),
}) })
} }