From b6b0952f41b00917d434d01913bc60ca3b97440f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 27 Sep 2025 19:00:23 +0000 Subject: [PATCH] Use idiomatic TempDir::keep() instead of std::mem::forget() Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com> --- src/run/environment.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/run/environment.rs b/src/run/environment.rs index 8343923..aa3141c 100644 --- a/src/run/environment.rs +++ b/src/run/environment.rs @@ -305,10 +305,8 @@ impl TestEnvironment { /// Preserve the work directory by preventing TempDir cleanup /// Returns the path to the preserved directory pub fn preserve_work_dir(self) -> std::path::PathBuf { - let work_dir = self.work_dir.clone(); - // Leak the TempDir to prevent cleanup - std::mem::forget(self._temp_dir); - work_dir + // Use the idiomatic way to preserve a TempDir + self._temp_dir.keep() } }