Skip to content

Commit c71df16

Browse files
ref(snapshots): Use existing TempFile helper instead of tempfile crate
Replace direct tempfile crate usage with the project's TempFile utility in the snapshots download command, keeping tempfile as dev-dependency only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 96016af commit c71df16

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ sha2 = "0.10.9"
7070
sourcemap = { version = "9.3.0", features = ["ram_bundle"] }
7171
symbolic = { version = "12.13.3", features = ["debuginfo-serde", "il2cpp"] }
7272
tar = "0.4"
73-
tempfile = "3.8.1"
7473
thiserror = "1.0.38"
7574
tokio = { version = "1.47", features = ["rt"] }
7675
url = "2.3.1"

src/commands/snapshots/download.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::fs;
2-
use std::io::{self, Seek as _};
2+
use std::io;
33
use std::path::PathBuf;
44

55
use anyhow::{bail, Result};
@@ -8,7 +8,7 @@ use clap::{Arg, ArgMatches, Command};
88
use crate::api::Api;
99
use crate::config::Config;
1010
use crate::utils::args::ArgExt as _;
11-
use crate::utils::fs::path_as_url;
11+
use crate::utils::fs::{path_as_url, TempFile};
1212

1313
const EXPERIMENTAL_WARNING: &str =
1414
"[EXPERIMENTAL] The \"snapshots download\" command is experimental. \
@@ -97,8 +97,9 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
9797
};
9898

9999
eprintln!("Downloading snapshot {snapshot_id}...");
100-
let mut tmp = tempfile::tempfile()?;
101-
let response = api.download_snapshot_zip(&org, &snapshot_id, &mut tmp)?;
100+
let tmp = TempFile::create()?;
101+
let mut tmp_file = tmp.open()?;
102+
let response = api.download_snapshot_zip(&org, &snapshot_id, &mut tmp_file)?;
102103

103104
if response.failed() {
104105
bail!(
@@ -107,8 +108,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
107108
);
108109
}
109110

110-
tmp.seek(io::SeekFrom::Start(0))?;
111-
let mut archive = zip::ZipArchive::new(&mut tmp)?;
111+
let mut archive = zip::ZipArchive::new(&mut tmp_file)?;
112112

113113
fs::create_dir_all(&output_dir)?;
114114

0 commit comments

Comments
 (0)