From: "Onur Özkan" <work@onurozkan.dev>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Matthew Maurer" <mmaurer@google.com>,
driver-core@lists.linux.dev, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: soc: silence clippy warning with rustc >= 1.88
Date: Tue, 7 Jul 2026 14:11:45 +0300 [thread overview]
Message-ID: <20260707111150.137899-1-work@onurozkan.dev> (raw)
In-Reply-To: <20260707-soc_unwrap_or-v1-1-1ca1757a259f@nvidia.com>
On Tue, 07 Jul 2026 19:12:21 +0900
Alexandre Courbot <acourbot@nvidia.com> wrote:
> The `clippy::unwrap_or_default` warning triggers on
> `rust/kernel/soc.rs` since rustc 1.88:
>
> warning: use of `unwrap_or` to construct default value
> --> ../rust/kernel/soc.rs:66:10
> |
> 66 | .unwrap_or(core::ptr::null())
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unwrap_or_default
> = note: `-W clippy::unwrap-or-default` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::unwrap_or_default)]`
>
> Since our current MSRV is 1.85, we cannot fix the warning as
> recommended, so allow the lint on the `cstring_to_c` function instead.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> rust/kernel/soc.rs | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/rust/kernel/soc.rs b/rust/kernel/soc.rs
> index 0d6a36c83cb6..7998962560f8 100644
> --- a/rust/kernel/soc.rs
> +++ b/rust/kernel/soc.rs
> @@ -60,6 +60,9 @@ struct BuiltAttributes {
> inner: Opaque<bindings::soc_device_attribute>,
> }
>
> +// `unwrap_or_default()` on a raw pointer requires `Default for *const T`, which is stable since
> +// Rust 1.88. Remove when the MSRV allows it.
I would move "Remove when the MSRV allows it." to the next line as TODO.
Regards,
Onur
> +#[allow(clippy::unwrap_or_default)]
> fn cstring_to_c(mcs: &Option<CString>) -> *const kernel::ffi::c_char {
> mcs.as_ref()
> .map(|cs| cs.as_char_ptr())
>
> ---
> base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
> change-id: 20260707-soc_unwrap_or-ed37e674a759
>
> Best regards,
> --
> Alexandre Courbot <acourbot@nvidia.com>
>
next prev parent reply other threads:[~2026-07-07 11:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 10:12 [PATCH] rust: soc: silence clippy warning with rustc >= 1.88 Alexandre Courbot
2026-07-07 11:11 ` Onur Özkan [this message]
2026-07-07 11:43 ` Gary Guo
2026-07-07 12:12 ` Alexandre Courbot
2026-07-07 12:12 ` Miguel Ojeda
2026-07-07 14:19 ` Alexandre Courbot
2026-07-07 14:30 ` Gary Guo
2026-07-08 8:25 ` Alexandre Courbot
2026-07-08 9:04 ` Miguel Ojeda
2026-07-08 10:11 ` Alexandre Courbot
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=20260707111150.137899-1-work@onurozkan.dev \
--to=work@onurozkan.dev \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mmaurer@google.com \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.