Skip to content

Unneeded Unit Expression Warning From Clippy #2774

Closed
@jyhi

Description

@jyhi

Describe the Bug

wasm-bindgen 0.2.79 released not long ago triggered a workflow error in our repository, which doesn't exist before.

A local run of cargo +nightly clippy -- -Z macro-backtrace with clippy 0.1.60 (5e57faa 2022-01-19) prints the following:

    Checking client-wasm v0.0.1 (/home/user/repo/iota.rs/bindings/wasm/native)
warning: unneeded unit expression
  --> src/address_getter.rs:22:1
   |
22 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = note: `#[warn(clippy::unused_unit)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/address_getter.rs:22:1
   |
22 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/balance_getter.rs:20:1
   |
20 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/client.rs:46:1
   |
46 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/client_builder.rs:28:1
   |
28 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/get_address.rs:16:1
   |
16 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/message_builder.rs:36:1
   |
36 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/message_getter.rs:17:1
   |
17 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/unspent_address_getter.rs:19:1
   |
19 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:22:1
   |
22 | pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ---------------------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen::prelude::__wasm_bindgen_class_marker]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: unneeded unit expression
  --> src/lib.rs:27:1
   |
27 | #[wasm_bindgen(start)]
   | ^^^^^^^^^^^^^^^^^^^^^^ in this procedural macro expansion
   |
  ::: /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-macro-0.2.79/src/lib.rs:9:1
   |
9  | pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream {
   | ------------------------------------------------------------------------- in this expansion of `#[wasm_bindgen]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit

warning: `client-wasm` (lib) generated 100 warnings (90 duplicates)
    Finished dev [unoptimized + debuginfo] target(s) in 0.77s

Steps to Reproduce

  1. git clone https://github.com/iotaledger/iota.rs
  2. cd iota.rs/bindings/wasm/native
  3. cargo clippy (version of toolchain doesn't actually matter)
  4. See warnings

Expected Behavior

No warning should be given.

Actual Behavior

client-wasm (lib) generated 100 warnings (90 duplicates).

Additional Context

We haven't tried to identify whether this is a problem from our side yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions