rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benno Lossin <benno.lossin@proton.me>
To: "Filipe Xavier" <felipeaggger@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: daniel.almeida@collabora.com, rust-for-linux@vger.kernel.org,
	felipe_life@live.com, linux-kernel@vger.kernel.org,
	Lyude Paul <lyude@redhat.com>
Subject: Re: [PATCH v2] rust: add new macro for common bitmap operations
Date: Tue, 25 Mar 2025 13:34:20 +0000	[thread overview]
Message-ID: <D8PDWRH06U1X.3JGHP1311BPPY@proton.me> (raw)
In-Reply-To: <20250325-feat-add-bitmask-macro-v2-1-d3beabdad90f@gmail.com>

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)
> +            }
> +        }


  reply	other threads:[~2025-03-25 13:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 13:10 [PATCH v2] rust: add new macro for common bitmap operations Filipe Xavier
2025-03-25 13:34 ` Benno Lossin [this message]
2025-03-25 14:17   ` Miguel Ojeda
2025-03-25 13:54 ` Daniel Almeida
2025-03-27  5:05 ` kernel test robot
2025-03-31 22:29 ` Lyude Paul
2025-03-31 22:35   ` Daniel Almeida
2025-03-31 22:50     ` Lyude Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D8PDWRH06U1X.3JGHP1311BPPY@proton.me \
    --to=benno.lossin@proton.me \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=felipe_life@live.com \
    --cc=felipeaggger@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).