From 076af5084afe8e995d1becf4160bafd0c9ee72f7 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 16 Oct 2025 14:50:18 +0800 Subject: [PATCH] style: fix clippy::redundant_closure_for_method_calls warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace redundant closures with direct method references: - with_argv.rs: Replace |p| p.is_null() with <*const i8>::is_null - which.rs: Replace |s| s.to_owned() with BStr::to_owned 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../fspy_preload_unix/src/interceptions/spawn/exec/with_argv.rs | 2 +- crates/fspy_shared_unix/src/exec/which.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fspy_preload_unix/src/interceptions/spawn/exec/with_argv.rs b/crates/fspy_preload_unix/src/interceptions/spawn/exec/with_argv.rs index 78e71d7914..bf318d1111 100644 --- a/crates/fspy_preload_unix/src/interceptions/spawn/exec/with_argv.rs +++ b/crates/fspy_preload_unix/src/interceptions/spawn/exec/with_argv.rs @@ -16,7 +16,7 @@ pub unsafe fn with_argv( let argc = 1 + unsafe { va.with_copy(|mut copy| { core::iter::from_fn(|| Some(copy.arg::<*const c_char>())) - .position(|p| p.is_null()) + .position(<*const i8>::is_null) .unwrap() }) }; diff --git a/crates/fspy_shared_unix/src/exec/which.rs b/crates/fspy_shared_unix/src/exec/which.rs index c6488e8a87..7014706811 100644 --- a/crates/fspy_shared_unix/src/exec/which.rs +++ b/crates/fspy_shared_unix/src/exec/which.rs @@ -86,7 +86,7 @@ mod tests { #[test] fn test_concat() { - let s = concat(&["a".into(), "bc".into(), "".into(), "e".into()], |s| s.to_owned()); + let s = concat(&["a".into(), "bc".into(), "".into(), "e".into()], BStr::to_owned); assert_eq!(s, "abce"); }