Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy lint empty_docs #3946

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 16 additions & 3 deletions crates/backend/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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

Expand Down