Skip to content

Commit 93c15e6

Browse files
committed
style: fix clippy needless-pass-by-ref-mut
1 parent b2265ae commit 93c15e6

18 files changed

Lines changed: 39 additions & 39 deletions

File tree

crates/fspy/src/unix/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ pub(crate) async fn spawn_impl(mut command: Command) -> io::Result<TrackedChild>
175175
let supervisor = supervise::<SyscallHandler>()?;
176176

177177
#[cfg(target_os = "linux")]
178-
let mut supervisor_pre_exec = supervisor.pre_exec;
178+
let supervisor_pre_exec = supervisor.pre_exec;
179179

180180
let payload = Payload {
181181
ipc_fd: shm_fd_sender.as_raw_fd(),
@@ -201,7 +201,7 @@ pub(crate) async fn spawn_impl(mut command: Command) -> io::Result<TrackedChild>
201201

202202
let mut exec = command.get_exec();
203203
let mut exec_resolve_accesses = PathAccessArena::default();
204-
let mut pre_exec = handle_exec(
204+
let pre_exec = handle_exec(
205205
&mut exec,
206206
ExecResolveConfig::search_path_enabled(None),
207207
&encoded_payload,
@@ -221,7 +221,7 @@ pub(crate) async fn spawn_impl(mut command: Command) -> io::Result<TrackedChild>
221221

222222
#[cfg(target_os = "linux")]
223223
supervisor_pre_exec.run()?;
224-
if let Some(pre_exec) = &mut pre_exec {
224+
if let Some(pre_exec) = pre_exec.as_ref() {
225225
pre_exec.run()?;
226226
}
227227
Ok(())

crates/fspy_preload_unix/src/interceptions/spawn/exec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn handle_exec(
3535
global_client().expect("exec unexpectedly called before client initialized in ctor");
3636
let result = unsafe {
3737
client.handle_exec(config, RawExec { prog, argv, envp }, |raw_command, pre_exec| {
38-
if let Some(mut pre_exec) = pre_exec {
38+
if let Some(pre_exec) = pre_exec {
3939
pre_exec.run()?
4040
};
4141
Ok(execve::original()(raw_command.prog, raw_command.argv, raw_command.envp))

crates/fspy_preload_unix/src/interceptions/spawn/posix_spawn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ unsafe fn handle_posix_spawn(
5151
raw_command.envp.cast(),
5252
)
5353
};
54-
if let Some(mut pre_exec) = pre_exec {
54+
if let Some(pre_exec) = pre_exec {
5555
thread::scope(move |s| {
5656
let call_original = AssertSend(call_original);
5757
s.spawn(move || {

crates/fspy_seccomp_unotify/src/supervisor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct Supervisor<F> {
2727

2828
pub struct PreExec(OwnedFd);
2929
impl PreExec {
30-
pub fn run(&mut self) -> nix::Result<()> {
30+
pub fn run(&self) -> nix::Result<()> {
3131
let mut fd_flag = FdFlag::from_bits_retain(fcntl(&self.0, FcntlArg::F_GETFD)?);
3232
fd_flag.remove(FdFlag::FD_CLOEXEC);
3333
fcntl(&self.0, FcntlArg::F_SETFD(fd_flag))?;

crates/fspy_seccomp_unotify/tests/arg_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async fn run_in_pre_exec(
5252
) -> Result<Vec<Syscall>, Box<dyn Error>> {
5353
Ok(timeout(Duration::from_secs(5), async move {
5454
let mut cmd = Command::new("/bin/echo");
55-
let Supervisor { payload, handling_loop, mut pre_exec } = supervise::<SyscallRecorder>()?;
55+
let Supervisor { payload, handling_loop, pre_exec } = supervise::<SyscallRecorder>()?;
5656

5757
unsafe {
5858
cmd.pre_exec(move || {

crates/fspy_shared_unix/src/spawn/linux/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const LD_PRELOAD: &str = "LD_PRELOAD";
1515

1616
pub struct PreExec(SeccompPayload);
1717
impl PreExec {
18-
pub fn run(&mut self) -> nix::Result<()> {
18+
pub fn run(&self) -> nix::Result<()> {
1919
install_target(&self.0)
2020
}
2121
}

crates/fspy_shared_unix/src/spawn/macos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::{
1515

1616
pub struct PreExec(Infallible);
1717
impl PreExec {
18-
pub fn run(&mut self) -> nix::Result<()> {
18+
pub fn run(&self) -> nix::Result<()> {
1919
match self.0 {}
2020
}
2121
}

crates/vite_task/src/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl TaskCache {
127127
}
128128

129129
pub async fn update(
130-
&mut self,
130+
&self,
131131
resolved_task: &ResolvedTask,
132132
cached_task: CommandCacheValue,
133133
) -> Result<(), Error> {

crates/vite_task/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010

1111
pub async fn doc<Doc: Future<Output = Result<ResolveCommandResult, Error>>, DocFn: Fn() -> Doc>(
1212
resolve_doc_command: DocFn,
13-
workspace: &mut Workspace,
13+
workspace: &Workspace,
1414
args: &Vec<String>,
1515
) -> Result<ExecutionSummary, Error> {
1616
let resolved_task =

crates/vite_task/src/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct FmtConfig {
1818
#[tracing::instrument(skip(resolve_fmt_command, workspace))]
1919
pub async fn fmt<Fmt: Future<Output = Result<ResolveCommandResult, Error>>, FmtFn: Fn() -> Fmt>(
2020
resolve_fmt_command: FmtFn,
21-
workspace: &mut Workspace,
21+
workspace: &Workspace,
2222
args: &Vec<String>,
2323
) -> Result<ExecutionSummary, Error> {
2424
let resolved_task =

0 commit comments

Comments
 (0)