We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aab29c4 commit 85846b4Copy full SHA for 85846b4
c-bindings-gen/src/types.rs
@@ -1717,10 +1717,10 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1717
(format!("{} {{ None }} else {{ Some(", s), format!("unsafe {{ &mut *{} }}", var_access))
1718
], ") }", ContainerPrefixLocation::NoPrefix)),
1719
EmptyValExpectedTy::OptionType =>
1720
- return Some(("{ /* ", vec![
1721
- (format!("*/ let {}_opt = {};", var_name, var_access),
1722
- format!("}} if {}_opt{} {{ None }} else {{ Some({{ {}_opt.take()", var_name, s, var_name))
1723
- ], ") } }", ContainerPrefixLocation::PerConv)),
+ return Some(("{ /*", vec![
+ (format!("*/ let {}_opt = {}; if {}_opt{} {{ None }} else {{ Some({{", var_name, var_access, var_name, s),
+ format!("{{ {}_opt.take() }}", var_name))
+ ], "})} }", ContainerPrefixLocation::PerConv)),
1724
EmptyValExpectedTy::NonPointer =>
1725
return Some(("if ", vec![
1726
(format!("{} {{ None }} else {{ Some(", s), format!("{}", var_access))
0 commit comments