[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D8PDWRH06U1X.3JGHP1311BPPY@proton.me>
Date: Tue, 25 Mar 2025 13:34:20 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Filipe Xavier <felipeaggger@...il.com>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>
Cc: daniel.almeida@...labora.com, rust-for-linux@...r.kernel.org, felipe_life@...e.com, linux-kernel@...r.kernel.org, Lyude Paul <lyude@...hat.com>
Subject: Re: [PATCH v2] rust: add new macro for common bitmap operations
On Tue Mar 25, 2025 at 2:10 PM CET, Filipe Xavier wrote:
> +#[macro_export]
> +macro_rules! impl_flags {
> + (
> + $(#[$outer_flags:meta])* $vis_flags:vis $flags:ident,
> + $(#[$outer_flag:meta])* $vis_flag:vis $flag:ident,
> + $ty:ty
> + ) => {
> + $(#[$outer_flags])*
> + #[repr(transparent)]
> + #[derive(Copy, Clone, Default, PartialEq, Eq)]
> + $vis_flags struct $flags($ty);
> +
> + $(#[$outer_flag])*
> + #[derive(Copy, Clone, PartialEq, Eq)]
> + $vis_flag struct $flag($ty);
> +
> + impl From<$flag> for $flags {
Please use absolute paths to refer to items, in this case
`::core::convert::From` (note the leading `::`). More cases below.
I filed an issue to add a new clippy lint to catch this:
https://github.com/rust-lang/rust-clippy/issues/14472
---
Cheers,
Benno
> + #[inline]
> + fn from(value: $flag) -> Self {
> + Self(value.0)
> + }
> + }
Powered by blists - more mailing lists