rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Onur <work@onurozkan.dev>
To: Danilo Krummrich <dakr@kernel.org>
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, rafael@kernel.org, ojeda@kernel.org,
	alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net,
	bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu
Subject: Re: [PATCH] rust: simplify `Adapter::id_info`
Date: Thu, 26 Jun 2025 11:10:45 +0300	[thread overview]
Message-ID: <20250626111045.2c90a402@nimda> (raw)
In-Reply-To: <aFu10-dGkoyi0I2T@cassiopeiae>

On Wed, 25 Jun 2025 10:39:47 +0200
Danilo Krummrich <dakr@kernel.org> wrote:

> On Wed, Jun 25, 2025 at 11:36:04AM +0300, Onur wrote:
> > Even with that, it can be something like this:
> > 
> > fn id_info(dev: &device::Device) -> Option<&'static Self::IdInfo> {
> >     let id = Self::acpi_id_info(dev);
> >     if id.is_some() {
> >         return id;
> >     }
> > 
> >     Self::of_id_info(dev)
> > }
> > 
> > or maybe even this:
> > 
> > fn id_info(dev: &device::Device) -> Option<&'static Self::IdInfo> {
> >     Self::acpi_id_info(dev).or_else(|| Self::of_id_info(dev))
> > }
> 
> That's fair, can you please rebase your patch onto [1]?
> 
> [1]
> https://lore.kernel.org/lkml/20250620153914.295679-1-igor.korotin.linux@gmail.com/

HEAD: e0b49ca268d4a0d2b97d5820420d5a78b67d2537 currently doesn't pass
clippy. Should I send an additional change for the clippy fix or would
you prefer to fix it yourself first?

Here is the output of `make LLVM=1 -j $(nproc) CLIPPY=1`:

```
  DESCEND objtool
  CALL    scripts/checksyscalls.sh
  INSTALL libsubcmd_headers
  CLIPPY L rust/kernel.o
error: unneeded `return` statement
   --> rust/kernel/driver.rs:188:13
    |
188 |             return None;
    |             ^^^^^^^^^^^
    |
    = help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `-D clippy::needless-return` implied by `-D warnings` = help:
to override `-D warnings` add `#[allow(clippy::needless_return)]` help:
remove `return` |
188 -             return None;
188 +             None
    |

error: aborting due to 1 previous error

make[2]: *** [rust/Makefile:538: rust/kernel.o] Error 1
make[1]: *** [/home/nimda/devspace/onur-ozkan/linux/Makefile:1280:
prepare] Error 2 make: *** [Makefile:248: __sub-make] Error 2
```

  reply	other threads:[~2025-06-26  8:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25  4:36 [PATCH] rust: simplify `Adapter::id_info` Onur Özkan
2025-06-25  8:22 ` Danilo Krummrich
2025-06-25  8:36   ` Onur
2025-06-25  8:39     ` Danilo Krummrich
2025-06-26  8:10       ` Onur [this message]
2025-06-26  9:41         ` Miguel Ojeda
2025-06-26  9:48           ` Danilo Krummrich
2025-06-26  9:59             ` Miguel Ojeda

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=20250626111045.2c90a402@nimda \
    --to=work@onurozkan.dev \
    --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=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rafael@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).