Skip to content

Commit 33d149c

Browse files
committed
nit
1 parent 23fbf16 commit 33d149c

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/main.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ fn build_command(bin_name: Option<String>, output: Option<PathBuf>) -> Result<()
6666
debug!("Found Cargo.toml at: {}", manifest_path.display());
6767

6868
let cargo_toml_content = fs::read_to_string(&manifest_path)
69-
.with_context(|| format!("Failed to read Cargo.toml at {}", manifest_path.display()))?;
69+
.with_context(|| format!("Failed to read Cargo.toml at {manifest_path:?}"))?;
7070

7171
let doc = cargo_toml_content
7272
.parse::<toml_edit::DocumentMut>()
7373
.context("Failed to parse Cargo.toml")?;
7474

7575
let bin_name = if let Some(name) = bin_name {
76-
debug!("Using specified binary name: {}", name);
76+
debug!("Using specified binary name: {name}");
7777
name
7878
} else {
7979
let first_bin_name = doc
@@ -91,7 +91,7 @@ fn build_command(bin_name: Option<String>, output: Option<PathBuf>) -> Result<()
9191
let work_dir = manifest_path.parent().unwrap();
9292
let build_dir = work_dir.join("target");
9393
let elf_path = build_contract(&manifest_path, &build_dir, &bin_name)?;
94-
let output_path = output.unwrap_or_else(|| PathBuf::from(format!("./{}.polkavm", bin_name)));
94+
let output_path = output.unwrap_or_else(|| PathBuf::from(format!("./{bin_name}.polkavm")));
9595
link_to_polkavm(&elf_path, &output_path)?;
9696

9797
println!("Successfully built contract: {output_path:?}");
@@ -186,12 +186,10 @@ fn extract_embedded_dir_impl(
186186

187187
// Skip _Cargo.toml as it's handled separately in copy_embedded_template
188188
if relative_path.file_name().and_then(|n| n.to_str()) == Some("_Cargo.toml") {
189-
debug!("Skipping _Cargo.toml (will be processed separately)");
190189
continue;
191190
}
192191

193192
let file_path = target_dir.join(relative_path);
194-
195193
debug!("Extracting file: {relative_path:?}");
196194

197195
// Create parent directories if needed
@@ -251,7 +249,6 @@ fn build_contract(manifest_path: &PathBuf, build_dir: &PathBuf, bin_name: &str)
251249
build_command
252250
.current_dir(work_dir)
253251
.env("RUSTC_BOOTSTRAP", "1")
254-
.env("SKIP_BUILD_SCRIPT", "1")
255252
.args(["build", "--release", "--manifest-path"])
256253
.arg(manifest_path)
257254
.args([
@@ -264,13 +261,10 @@ fn build_contract(manifest_path: &PathBuf, build_dir: &PathBuf, bin_name: &str)
264261
]);
265262

266263
debug!("Running: {build_command:?}");
267-
268-
// Spawn the build process and inherit stdout/stderr for real-time output
269264
let mut child = build_command
270265
.spawn()
271266
.context("Failed to execute cargo build")?;
272267

273-
// Wait for the build to complete
274268
let status = child.wait().context("Failed to wait for cargo build")?;
275269

276270
if !status.success() {
@@ -305,11 +299,9 @@ fn link_to_polkavm(elf_path: &PathBuf, output_path: &PathBuf) -> Result<()> {
305299
)
306300
.map_err(|err| anyhow::anyhow!("Failed to link PolkaVM program: {err:?}"))?;
307301

308-
let linked_size = linked.len();
309-
310-
fs::write(output_path, linked)
302+
fs::write(output_path, &linked)
311303
.with_context(|| format!("Failed to write PolkaVM bytecode to {output_path:?}"))?;
312304

313-
debug!("Wrote {linked_size} bytes to {output_path:?}");
305+
debug!("Wrote {} bytes to {output_path:?}", linked.len());
314306
Ok(())
315307
}

0 commit comments

Comments
 (0)