Don't generate "-> ()" for functions returning unit
MODIFY
binding-generator/src/writer/rust_native/func.rs
binding-generator/src/writer/rust_native/func.rs
@@ -99,6 +99,11 @@ fn gen_rust_with_name(f: &Func, name: &str, opencv_version: &str) -> String {
} else {
format!("Result<{}>", return_type.rust_return_func_decl(FishStyle::No, is_static_func)).into()
};
+ let return_type_func_decl = if return_type_func_decl == "()" {
+ Cow::Borrowed("")
+ } else {
+ format!(" -> {}", return_type_func_decl).into()
+ };
let mut prefix = String::new();
let mut suffix = if is_infallible {
format!(".expect(\"Infallible function failed: {name}\")", name = name)

MODIFY
binding-generator/src/writer/rust_native/tpl/func/rust.tpl.rs
binding-generator/src/writer/rust_native/tpl/func/rust.tpl.rs
{{debug}}
#[inline]
{{attributes}}
-{{visibility}}{{unsafety_decl}}fn {{name}}{{generic_decl}}({{decl_args}}) -> {{rv_rust_full}} {
+{{visibility}}{{unsafety_decl}}fn {{name}}{{generic_decl}}({{decl_args}}){{rv_rust_full}} {
{{pre_call_args}}
{{prefix}}{{unsafety_call}}{ sys::{{identifier}}({{call_args}}) }.into_result(){{ret_map}}{{suffix}}
{{post_call_args}}

Don't generate "-> ()" for functions returning unit