Skip to content

Commit 5f13de2

Browse files
committed
Do not include docstring if empty
Closes #3945
1 parent ad251c0 commit 5f13de2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

crates/backend/src/codegen.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,10 +867,18 @@ impl ToTokens for ast::ImportType {
867867

868868
let no_deref = self.no_deref;
869869

870+
let doc = if doc_comment.is_empty() {
871+
quote! {}
872+
} else {
873+
quote! {
874+
#[doc = #doc_comment]
875+
}
876+
};
877+
870878
(quote! {
871879
#[automatically_derived]
872880
#(#attrs)*
873-
#[doc = #doc_comment]
881+
#doc
874882
#[repr(transparent)]
875883
#vis struct #rust_name {
876884
obj: #internal_obj

0 commit comments

Comments
 (0)