From: Jocelyn Falempe <jfalempe@redhat.com>
To: "Thomas Böhler" <witcher@wiredspace.de>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
rust-for-linux@vger.kernel.org,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] drm/panic: remove unnecessary borrow in alignment_pattern
Date: Mon, 14 Oct 2024 10:45:40 +0200 [thread overview]
Message-ID: <db18fcea-7dfe-4edc-8e3a-8078860656b3@redhat.com> (raw)
In-Reply-To: <20241012075312.16342-2-witcher@wiredspace.de>
On 12/10/2024 09:52, Thomas Böhler wrote:
> The function `alignment_pattern` returns a static reference to a `u8`
> slice. The borrow of the returned element in `ALIGNMENT_PATTERNS` is
> already a reference as defined in the array definition above so this
> borrow is unnecessary and removed by the compiler. Clippy notes this in
> `needless_borrow`:
>
> error: this expression creates a reference which is immediately dereferenced by the compiler
> --> drivers/gpu/drm/drm_panic_qr.rs:245:9
> |
> 245 | &ALIGNMENT_PATTERNS[self.0 - 1]
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `ALIGNMENT_PATTERNS[self.0 - 1]`
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
> = note: `-D clippy::needless-borrow` implied by `-D warnings`
> = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]`
>
> Remove the unnecessary borrow.
Thanks, it looks good to me.
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
>
> Reported-by: Miguel Ojeda <ojeda@kernel.org>
> Closes: https://github.com/Rust-for-Linux/linux/issues/1123
> Signed-off-by: Thomas Böhler <witcher@wiredspace.de>
> ---
> drivers/gpu/drm/drm_panic_qr.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_panic_qr.rs b/drivers/gpu/drm/drm_panic_qr.rs
> index 76decf49e678..7adfaa3d6222 100644
> --- a/drivers/gpu/drm/drm_panic_qr.rs
> +++ b/drivers/gpu/drm/drm_panic_qr.rs
> @@ -239,7 +239,7 @@ fn g1_blk_size(&self) -> usize {
> }
>
> fn alignment_pattern(&self) -> &'static [u8] {
> - &ALIGNMENT_PATTERNS[self.0 - 1]
> + ALIGNMENT_PATTERNS[self.0 - 1]
> }
>
> fn poly(&self) -> &'static [u8] {
next prev parent reply other threads:[~2024-10-14 8:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 7:52 [PATCH 1/7] drm/panic: avoid reimplementing Iterator::find Thomas Böhler
2024-10-12 7:52 ` [PATCH 2/7] drm/panic: remove unnecessary borrow in alignment_pattern Thomas Böhler
2024-10-14 8:45 ` Jocelyn Falempe [this message]
2024-10-12 7:52 ` [PATCH 3/7] drm/panic: prefer eliding lifetimes Thomas Böhler
2024-10-14 8:46 ` Jocelyn Falempe
2024-10-12 7:52 ` [PATCH 4/7] drm/panic: remove redundant field when assigning value Thomas Böhler
2024-10-14 8:46 ` Jocelyn Falempe
2024-10-12 7:52 ` [PATCH 5/7] drm/panic: correctly indent continuation of line in list item Thomas Böhler
2024-10-14 8:47 ` Jocelyn Falempe
2024-10-12 7:52 ` [PATCH 6/7] drm/panic: allow verbose boolean for clarity Thomas Böhler
2024-10-14 8:27 ` Alice Ryhl
2024-10-14 8:28 ` Alice Ryhl
2024-10-14 8:54 ` Jocelyn Falempe
2024-10-14 16:59 ` Miguel Ojeda
2024-10-14 19:23 ` Jocelyn Falempe
2024-10-12 7:52 ` [PATCH 7/7] drm/panic: allow verbose version check Thomas Böhler
2024-10-12 11:08 ` Miguel Ojeda
2024-10-14 8:55 ` Jocelyn Falempe
2024-10-12 11:04 ` [PATCH 1/7] drm/panic: avoid reimplementing Iterator::find Miguel Ojeda
2024-10-14 9:06 ` Jocelyn Falempe
2024-10-19 7:46 ` Thomas Böhler
2024-10-19 7:45 ` Thomas Böhler
2024-10-14 8:44 ` Jocelyn Falempe
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=db18fcea-7dfe-4edc-8e3a-8078860656b3@redhat.com \
--to=jfalempe@redhat.com \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=tzimmermann@suse.de \
--cc=witcher@wiredspace.de \
/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).