Skip to content

bitfield macro triggers clippy::must_use_candidate lints since 2.0.1 #140

Description

@nicopap

Hoy,

awesome crate, really ❤️

Since the release of 2.0.1 this morning, I'm getting a clippy::must_use_candidate lint in my project. It's a lint from the pedantic set.

Steps to reproduce

Linting this code with the command cargo clippy -- -W clippy::pedantic:

use bitbybit::bitfield;

#[bitfield(u8)]
pub struct ErrorFlags {
    #[bit(0, rw)]
    field1: bool,
}

fn main() {}

I get the following error message:

warning: this method could have a `#[must_use]` attribute
 --> src/main.rs:4:12
  |
4 | pub struct ErrorFlags {
  |            ^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#e
  = note: `-W clippy::must-use-candidate` implied by `-W clippy::pedantic`
  = help: to override `-W clippy::pedantic` add `#[allow(clippy::must_use_candidate)]`
help: add the attribute
  |
4 | pub struct #[must_use]
  |            +++++++++++

I tested with 2.0.0 and 2.0.1, and I can confirm that it only occurs in 2.0.1

Workaround

My current workaround is to add a #![allow(clippy::must_use_candidate)] to the module.


Cheers!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions