[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <eca1e3239800028ee7be4971fe10c145bd583913.1750689857.git.y.j3ms.n@gmail.com>
Date: Mon, 23 Jun 2025 15:14:29 +0000
From: Jesung Yang <y.j3ms.n@...il.com>
To: 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>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>
Cc: linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org,
nouveau@...ts.freedesktop.org,
Jesung Yang <y.j3ms.n@...il.com>
Subject: [PATCH 3/4] rust: macros: prefix variable `span` with underscore
Prefix the variable `span` in `quote_spanned!` macro with an underscore
to silence unused variable warnings.
The warning occurs when the macro is used without any uninterpolated
identifiers. For example:
// Triggers a warning: "unused variable: `span`"
quote! { #foo }
// This is fine
quote! { Some(#foo) }
There is no good reason to disallow such quoting patterns, so fix the
warning instead.
Signed-off-by: Jesung Yang <y.j3ms.n@...il.com>
---
rust/macros/quote.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/macros/quote.rs b/rust/macros/quote.rs
index d05f60f55623..e6c36bd7f925 100644
--- a/rust/macros/quote.rs
+++ b/rust/macros/quote.rs
@@ -63,8 +63,8 @@ macro_rules! quote_spanned {
#[allow(clippy::vec_init_then_push)]
{
tokens = ::std::vec::Vec::new();
- let span = $span;
- quote_spanned!(@proc tokens span $($tt)*);
+ let _span = $span;
+ quote_spanned!(@proc tokens _span $($tt)*);
}
::proc_macro::TokenStream::from_iter(tokens)
}};
--
2.39.5
Powered by blists - more mailing lists