rust: pin-init: examples: fix `useless_borrows_in_formatting` clippy warning
Subsystems (2)
PATCH 1/1 rust: pin-init: examples: fix `useless_borrows_in_formatting` clippy warning
From: Gary Guo <[email protected]>
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.
---
The examples are not built in the kernel tree and they're really just examples for reference purpose.
They're, however, built and required to kept lint-clean in pin-init CI.
--- rust/pin-init/examples/mutex.rs | 2 +- rust/pin-init/examples/pthread_mutex.rs | 2 +- rust/pin-init/examples/static_init.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
rust/pin-init/examples/mutex.rs +1 -1
@@ -220,7 +220,7 @@ fn main() {for hin handles { h.join ().expect ("thread panicked" ); } -println! ("{:?}" , &*mtx.lock ()); +println! ("{:?}" , *mtx.lock ());assert_eq! (*mtx.lock (), workload * thread_count *2 ); } }
rust/pin-init/examples/pthread_mutex.rs +1 -1
@@ -179,7 +179,7 @@ fn main() {for hin handles { h.join ().expect ("thread panicked" ); } -println! ("{:?}" , &*mtx.lock ()); +println! ("{:?}" , *mtx.lock ());assert_eq! (*mtx.lock (), workload * thread_count *2 ); } }
rust/pin-init/examples/static_init.rs +1 -1
@@ -119,7 +119,7 @@ fn main() {for hin handles { h.join ().expect ("thread panicked" ); } -println! ("{:?}, {:?}" , &*mtx.lock (), &*COUNT .lock ()); +println! ("{:?}, {:?}" , *mtx.lock (), *COUNT .lock ());assert_eq! (*mtx.lock (), workload * thread_count *2 ); } }
base-commit: 97e797263a5e963da3d1e66e743fd518567dfe37
Signature · 1 line
2.51.2
Quoted 7 lines · Gary Guo
From: Gary Guo <[email protected]>
Clippy 1.97 introduces new
useless_borrows_in_formattingwarning which fires on the examples as we have&*exprwhere the format macro takes reference already. Remove the extra borrow.Signed-off-by Gary Guo <[email protected]>
Applied to pin-init-next.
Best,
Gary