Skip to content

clippy warning on bitmask! macro #2

@vroussea

Description

@vroussea

Hello, I'm using bitmask macro in my code, and I'm getting a clippy warning for the following code :

#[allow(clippy::all)]
bitmask! {
    pub mask MethodsMask: u32 where flags MethodFlag {
        Post = Methods::POST,
        Get = Methods::GET,
        Delete = Methods::DELETE,
        Update = Methods::UPDATE,
        Other = Methods::OTHER,
    }
}

pub struct Methods {

}

impl Methods {
    pub const POST: u32 = 1;
    pub const GET: u32 = 2;
    pub const DELETE: u32 = 4;
    pub const UPDATE: u32 = 8;
    pub const OTHER: u32 = 16;
}

The warning :

warning: transmute from a reference to a reference
  --> src/***/***.rs:46:1
   |
46 | / bitmask! {
47 | |     pub mask MethodsMask: u32 where flags MethodFlag {
48 | |         Post = Methods::POST,
49 | |         Get = Methods::GET,
...  |
53 | |     }
54 | | }
   | |_^
   |
   = note: #[warn(clippy::transmute_ptr_to_ptr)] on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#transmute_ptr_to_ptr
   = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

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