Skip to content

Commit

Permalink
Avoid pointer redirection for Optional slices
Browse files Browse the repository at this point in the history
  • Loading branch information
hculea committed Sep 18, 2024
1 parent ccccb33 commit 4686f13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/language/go.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ impl Language for Go {
format!("[]{}", self.format_type(rtype, generic_types)?)
}
SpecialRustType::Option(rtype) => {
format!("*{}", self.format_type(rtype, generic_types)?)
let formatted_type = self.format_type(rtype, generic_types)?;
let pointer = if rtype.is_vec() { "" } else { "*" };
format!("{pointer}{formatted_type}")
}
SpecialRustType::HashMap(rtype1, rtype2) => format!(
"map[{}]{}",
Expand Down

0 comments on commit 4686f13

Please sign in to comment.