Skip to content

Commit

Permalink
Don't generate unit tuple in clone macro as default-return value
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 22, 2023
1 parent dcc735f commit 64fcdbd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion glib-macros/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ let {0} = match {1}::clone::Upgrade::upgrade(&{0}) {{
)
}
(BorrowKind::Weak, Some(WrapperKind::DefaultReturn(ref r))) => {
let not_unit_ret = r.chars().any(|c| c != '(' && c != ')');
format!(
"\
let {0} = match {1}::clone::Upgrade::upgrade(&{0}) {{
Expand All @@ -210,7 +211,7 @@ let {0} = match {1}::clone::Upgrade::upgrade(&{0}) {{
}};",
name,
crate_ident_new(),
r,
if not_unit_ret { r } else { "" },
)
}
(BorrowKind::Weak, None) => {
Expand Down

0 comments on commit 64fcdbd

Please sign in to comment.