Skip to content
Snippets Groups Projects
Commit 8bc5e17f authored by Éloïs's avatar Éloïs
Browse files

style(xtask): fix rustc warnings

parent 69e36c14
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ mod gen_calls_doc; ...@@ -18,7 +18,7 @@ mod gen_calls_doc;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use clap::Parser; use clap::Parser;
use std::io::{BufReader, BufWriter, Read, Write}; use std::io::{BufReader, BufWriter};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::Command; use std::process::Command;
...@@ -82,13 +82,12 @@ fn inject_runtime_code(raw_spec: &Path, runtime: &Path) -> Result<()> { ...@@ -82,13 +82,12 @@ fn inject_runtime_code(raw_spec: &Path, runtime: &Path) -> Result<()> {
// Read runtime code // Read runtime code
// SAFETY: `mmap` is fundamentally unsafe since technically the file can change // SAFETY: `mmap` is fundamentally unsafe since technically the file can change
// underneath us while it is mapped; in practice it's unlikely to be a problem // underneath us while it is mapped; in practice it's unlikely to be a problem
let mut file = let file = std::fs::File::open(runtime).with_context(|| "Failed to open runtime wasm file")?;
std::fs::File::open(runtime).with_context(|| "Failed to open runtime wasm file")?; let runtime_code =
let mut runtime_code =
unsafe { memmap2::Mmap::map(&file).with_context(|| "Failed to read runtime wasm file")? }; unsafe { memmap2::Mmap::map(&file).with_context(|| "Failed to read runtime wasm file")? };
// Read raw spec // Read raw spec
let mut file = std::fs::File::open(raw_spec).with_context(|| "Failed to open raw spec file")?; let file = std::fs::File::open(raw_spec).with_context(|| "Failed to open raw spec file")?;
let reader = BufReader::new(file); let reader = BufReader::new(file);
let mut json: serde_json::Value = let mut json: serde_json::Value =
serde_json::from_reader(reader).with_context(|| "Failed to read raw spec file")?; serde_json::from_reader(reader).with_context(|| "Failed to read raw spec file")?;
...@@ -124,7 +123,7 @@ fn inject_runtime_code(raw_spec: &Path, runtime: &Path) -> Result<()> { ...@@ -124,7 +123,7 @@ fn inject_runtime_code(raw_spec: &Path, runtime: &Path) -> Result<()> {
// Write modified raw specs // Write modified raw specs
let mut file = std::fs::File::create(raw_spec)?; let file = std::fs::File::create(raw_spec)?;
serde_json::to_writer_pretty(BufWriter::new(file), &json) serde_json::to_writer_pretty(BufWriter::new(file), &json)
.with_context(|| "fail to write raw specs")?; .with_context(|| "fail to write raw specs")?;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment