Skip to contentSkip to conversation

rust: remove unneeded Rust 1.87.0 `allow(clippy::ptr_eq)`

PATCH Applied Miguel Ojeda 3 participants 4 messages May 20, 2025 – May 22, 2025

Subsystems (2)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 rust: remove unneeded Rust 1.87.0 `allow(clippy::ptr_eq)`

Before a change to relax the lint was backported to Rust 1.87.0 before its release, Clippy was expected to warn with:

    error: use `core::ptr::eq` when comparing raw pointers
       --> rust/kernel/list.rs:438:12
        |
    438 |         if self.first == item {
        |            ^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(self.first, item)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
        = note: `-D clippy::ptr-eq` implied by `-D warnings`
        = help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]`

The backported finally landed indeed, thus remove the allows we added back then, which were added just in case the backport did not land in time.

See commit a39f30870927 ("rust: allow Rust 1.87.0's clippy::ptr_eq lint") for details.

---
 rust/kernel/alloc/kvec.rs | 3 ---
 rust/kernel/list.rs       | 3 ---
 2 files changed, 6 deletions(-)
rust/kernel/alloc/kvec.rs +0 -3
index 87a71fd40c3c..ae9d072741ce 100644
@@ -2,9 +2,6 @@
 
 //! Implementation of [`Vec`].
 
-// May not be needed in Rust 1.87.0 (pending beta backport).
-#![allow(clippy::ptr_eq)]
-
 use super::{
     allocator::{KVmalloc, Kmalloc, Vmalloc},
     layout::ArrayLayout,
rust/kernel/list.rs +0 -3
index 2054682c5724..a335c3b1ff5e 100644
@@ -4,9 +4,6 @@
 
 //! A linked list implementation.
 
-// May not be needed in Rust 1.87.0 (pending beta backport).
-#![allow(clippy::ptr_eq)]
-
 use crate::sync::ArcBorrow;
 use crate::types::Opaque;
 use core::iter::{DoubleEndedIterator, FusedIterator};

base-commit: a5806cd506af5a7c19bcd596e4708b5c464bfd21

Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Miguel Ojeda

Before a change to relax the lint was backported to Rust 1.87.0 before its release, Clippy was expected to warn with:

    error: use `core::ptr::eq` when comparing raw pointers
       --> rust/kernel/list.rs:438:12
        |
    438 |         if self.first == item {
        |            ^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(self.first, item)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
        = note: `-D clippy::ptr-eq` implied by `-D warnings`
        = help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]`

The backported finally landed indeed, thus remove the allows we added back then, which were added just in case the backport did not land in time.

Quoted 5 lines

See commit a39f30870927 ("rust: allow Rust 1.87.0's clippy::ptr_eq lint") for details.

This commit message is worded in a confusing manner, but the change LGTM.

#2 lore raw
Quoted 3 lines · Alice Ryhl

This commit message is worded in a confusing manner, but the change LGTM.

Yeah, I wrote via rearranging a previous one, and sounds a bit strange. I can try to clarify it when I apply it.

Thanks!

Cheers,
Miguel

Applied
#3 lore raw
In reply to Miguel Ojeda
Quoted 18 lines · Miguel Ojeda

Before a change to relax the lint was backported to Rust 1.87.0 before its release, Clippy was expected to warn with:

    error: use `core::ptr::eq` when comparing raw pointers
       --> rust/kernel/list.rs:438:12
        |
    438 |         if self.first == item {
        |            ^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(self.first, item)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_eq
        = note: `-D clippy::ptr-eq` implied by `-D warnings`
        = help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]`

The backported finally landed indeed, thus remove the allows we added back then, which were added just in case the backport did not land in time.

Quoted 5 lines

See commit a39f30870927 ("rust: allow Rust 1.87.0's clippy::ptr_eq lint") for details.

Applied to rust-next -- thanks everyone!

[ Reworded for clarity. - Miguel ]

Cheers,
Miguel