Skip to content

Commit

Permalink
fix(gen-rust-wasm): get rid of unused unit warning
Browse files Browse the repository at this point in the history
  • Loading branch information
7sDream committed Jul 11, 2022
1 parent 2679e06 commit c2f47bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions crates/gen-rust-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1580,8 +1580,10 @@ impl Bindgen for FunctionBindgen<'_> {
match amt {
0 => {}
1 => {
self.push_str(&operands[0]);
self.push_str("\n");
if &operands[0] != "()" {
self.push_str(&operands[0]);
self.push_str("\n");
}
}
_ => {
self.push_str("(");
Expand Down
6 changes: 4 additions & 2 deletions crates/gen-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ pub trait RustGenerator {
sig: &FnSig,
) -> Vec<String> {
let params = self.print_docs_and_params(iface, func, param_mode, &sig);
self.push_str(" -> ");
self.print_ty(iface, &func.result, TypeMode::Owned);
if !std::matches!(func.result, Type::Unit) {
self.push_str(" -> ");
self.print_ty(iface, &func.result, TypeMode::Owned);
}
params
}

Expand Down

0 comments on commit c2f47bd

Please sign in to comment.