From: Zhao Liu <zhao1.liu@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org,
Zhao Liu <zhao1.liu@intel.com>
Subject: [PATCH v2 04/12] rust/common/uninit: Fix Clippy's complaints about lifetime
Date: Sun, 21 Sep 2025 00:05:12 +0800 [thread overview]
Message-ID: <20250920160520.3699591-5-zhao1.liu@intel.com> (raw)
In-Reply-To: <20250920160520.3699591-1-zhao1.liu@intel.com>
Clippy complains about the following cases and following its suggestion
to fix these warnings.
warning: the following explicit lifetimes could be elided: 'a
--> common/src/uninit.rs:38:6
|
38 | impl<'a, T, U> Deref for MaybeUninitField<'a, T, U> {
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
= note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
|
38 - impl<'a, T, U> Deref for MaybeUninitField<'a, T, U> {
38 + impl<T, U> Deref for MaybeUninitField<'_, T, U> {
|
warning: the following explicit lifetimes could be elided: 'a
--> common/src/uninit.rs:49:6
|
49 | impl<'a, T, U> DerefMut for MaybeUninitField<'a, T, U> {
| ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
49 - impl<'a, T, U> DerefMut for MaybeUninitField<'a, T, U> {
49 + impl<T, U> DerefMut for MaybeUninitField<'_, T, U> {
|
warning: `common` (lib) generated 2 warnings (run `cargo clippy --fix --lib -p common` to apply 2 suggestions)
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
rust/common/src/uninit.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/common/src/uninit.rs b/rust/common/src/uninit.rs
index e7f9fcd2e3fb..8d021b1dfc6e 100644
--- a/rust/common/src/uninit.rs
+++ b/rust/common/src/uninit.rs
@@ -35,7 +35,7 @@ pub const fn parent_mut(f: &mut Self) -> *mut T {
}
}
-impl<'a, T, U> Deref for MaybeUninitField<'a, T, U> {
+impl<T, U> Deref for MaybeUninitField<'_, T, U> {
type Target = MaybeUninit<U>;
fn deref(&self) -> &MaybeUninit<U> {
@@ -46,7 +46,7 @@ fn deref(&self) -> &MaybeUninit<U> {
}
}
-impl<'a, T, U> DerefMut for MaybeUninitField<'a, T, U> {
+impl<T, U> DerefMut for MaybeUninitField<'_, T, U> {
fn deref_mut(&mut self) -> &mut MaybeUninit<U> {
// SAFETY: self.child was obtained by dereferencing a valid mutable
// reference; the content of the memory may be invalid or uninitialized
--
2.34.1
next prev parent reply other threads:[~2025-09-20 15:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 16:05 [PATCH v2 00/12] rust: miscellaneous cleanup & HPET #property conversion Zhao Liu
2025-09-20 16:05 ` [PATCH v2 01/12] subprojects: Update .gitignore for proc-macro2 and syn Zhao Liu
2025-09-20 16:05 ` [PATCH v2 02/12] subprojects: Ignore .wraplock file generated by meson v1.9.0 Zhao Liu
2025-09-20 16:05 ` [PATCH v2 03/12] rust/qemu-macros: Fix Clippy's complaints about lambda parameter naming Zhao Liu
2025-09-20 16:05 ` Zhao Liu [this message]
2025-09-20 16:05 ` [PATCH v2 05/12] rust/qdev: use addr_of! in QDevProp Zhao Liu
2025-09-20 16:05 ` [PATCH v2 06/12] rust/qdev: Refine the documentation for QDevProp trait Zhao Liu
2025-09-23 21:02 ` Stefan Zabka
2025-09-20 16:05 ` [PATCH v2 07/12] rust/qdev: Support property info for more common types Zhao Liu
2025-09-20 16:05 ` [PATCH v2 08/12] rust/qdev: Support bit property in #property macro Zhao Liu
2025-09-20 16:05 ` [PATCH v2 09/12] rust/qdev: Test bit property for #property Zhao Liu
2025-09-20 16:05 ` [PATCH v2 10/12] rust/hpet: Clean up type mismatch for num_timers property Zhao Liu
2025-09-20 16:05 ` [PATCH v2 11/12] rust/hpet: Convert qdev properties to #property macro Zhao Liu
2025-09-20 16:05 ` [PATCH v2 12/12] rust/qdev: Drop declare_properties & define_property macros Zhao Liu
2025-09-23 7:51 ` [PATCH v2 00/12] rust: miscellaneous cleanup & HPET #property conversion Paolo Bonzini
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=20250920160520.3699591-5-zhao1.liu@intel.com \
--to=zhao1.liu@intel.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/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).