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

clippy warning on bitmask! macro #2

Open
vroussea opened this issue Sep 12, 2019 · 0 comments
Open

clippy warning on bitmask! macro #2

vroussea opened this issue Sep 12, 2019 · 0 comments

Comments

@vroussea
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant