Fix clippy lint empty_docs (#3946)

* Do not include docstring if empty

Closes #3945

* Move changelog entry to correct section
This commit is contained in:
Kevin Flansburg
2024-05-07 23:59:11 -04:00
committed by GitHub
parent ad251c06a6
commit 73e5a8c482
2 changed files with 19 additions and 3 deletions

View File

@@ -36,6 +36,9 @@
* Fix MSRV compilation.
[#3927](https://github.com/rustwasm/wasm-bindgen/pull/3927)
* Fixed `clippy::empty_docs` lint.
[#3946](https://github.com/rustwasm/wasm-bindgen/pull/3946)
--------------------------------------------------------------------------------
## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92)

View File

@@ -867,10 +867,18 @@ impl ToTokens for ast::ImportType {
let no_deref = self.no_deref;
let doc = if doc_comment.is_empty() {
quote! {}
} else {
quote! {
#[doc = #doc_comment]
}
};
(quote! {
#[automatically_derived]
#(#attrs)*
#[doc = #doc_comment]
#doc
#[repr(transparent)]
#vis struct #rust_name {
obj: #internal_obj
@@ -1319,7 +1327,12 @@ impl TryToTokens for ast::ImportFunction {
let abi_arguments = &abi_arguments[..];
let abi_argument_names = &abi_argument_names[..];
let doc_comment = &self.doc_comment;
let doc = if self.doc_comment.is_empty() {
quote! {}
} else {
let doc_comment = &self.doc_comment;
quote! { #[doc = #doc_comment] }
};
let me = if is_method {
quote! { &self, }
} else {
@@ -1368,7 +1381,7 @@ impl TryToTokens for ast::ImportFunction {
#[allow(nonstandard_style)]
#[allow(clippy::all, clippy::nursery, clippy::pedantic, clippy::restriction)]
#(#attrs)*
#[doc = #doc_comment]
#doc
#vis #maybe_async #maybe_unsafe fn #rust_name(#me #(#arguments),*) #ret {
#extern_fn