]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: pin-init: examples: fix `useless_borrows_in_formatting` clippy warning
authorGary Guo <gary@garyguo.net>
Tue, 5 May 2026 11:51:37 +0000 (12:51 +0100)
committerGary Guo <gary@garyguo.net>
Sun, 10 May 2026 22:00:51 +0000 (23:00 +0100)
Clippy 1.97 introduces new `useless_borrows_in_formatting` warning which
fires on the examples as we have `&*expr` where the format macro takes
reference already. Remove the extra borrow.

Link: https://patch.msgid.link/20260505115138.2466966-1-gary@kernel.org
Signed-off-by: Gary Guo <gary@garyguo.net>
rust/pin-init/examples/mutex.rs
rust/pin-init/examples/pthread_mutex.rs
rust/pin-init/examples/static_init.rs

index 8ed2d3219eb13f3b69f50f713a3412567de27b35..35ecb5f68dc31be34a5c127876dc61b483f8d17c 100644 (file)
@@ -218,7 +218,7 @@ fn main() {
         for h in handles {
             h.join().expect("thread panicked");
         }
-        println!("{:?}", &*mtx.lock());
+        println!("{:?}", *mtx.lock());
         assert_eq!(*mtx.lock(), workload * thread_count * 2);
     }
 }
index 4a66316471af7a0f1017c6e0fb29203764969a1e..00f457e6882720882283f907d90315689b6e7086 100644 (file)
@@ -177,7 +177,7 @@ fn main() {
         for h in handles {
             h.join().expect("thread panicked");
         }
-        println!("{:?}", &*mtx.lock());
+        println!("{:?}", *mtx.lock());
         assert_eq!(*mtx.lock(), workload * thread_count * 2);
     }
 }
index 906b96c5d4b95b699ff824fcb6cd063a23c6899d..58cd4241b78ce336f1f460def64ce0f6af606c1f 100644 (file)
@@ -117,7 +117,7 @@ fn main() {
         for h in handles {
             h.join().expect("thread panicked");
         }
-        println!("{:?}, {:?}", &*mtx.lock(), &*COUNT.lock());
+        println!("{:?}, {:?}", *mtx.lock(), *COUNT.lock());
         assert_eq!(*mtx.lock(), workload * thread_count * 2);
     }
 }