mcarton / rust-derivative

A set of alternative `derive` attributes for Rust
Apache License 2.0
420 stars 46 forks source link

Debug derivative causes clippy warning `let_underscore_must_use` #102

Open vicky5124 opened 2 years ago

vicky5124 commented 2 years ago

Describe the bug

Debug derivative causes clippy warning let_underscore_must_use

To Reproduce

#![error(clippy::let_underscore_must_use)]

#[derive(derivative::Derivative)]
#[derivative(Debug)]
pub struct Test {
    pub test: String,
}

Expected behavior

The clippy warning shouldn't show up, as there's no let bindings being used by the user when defining a structure.

Errors

cargo clippy

error: non-binding let on an expression with `#[must_use]` type
  --> src/lib.rs:16:12
   |
16 | pub struct Test {
   |            ^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:5:5
   |
5  |     clippy::let_underscore_must_use
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: consider explicitly using expression value
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_must_use

Version

rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.59.0-nightly (0b42deacc 2021-12-09)`
cargo 1.58.0-nightly (40dc28175 2021-12-06)
rustc 1.59.0-nightly (0b42deacc 2021-12-09)