chore(bench): fix build and clippy

This commit is contained in:
Lucas Nogueira
2025-08-24 07:14:53 -03:00
parent d54f3b95a6
commit c0d3f9d47e
3 changed files with 10 additions and 10 deletions

View File

@@ -10,6 +10,8 @@
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png",
html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png"
)]
// file is used by multiple binaries
#![allow(dead_code)]
use std::{fs::File, io::BufReader};
mod utils;

View File

@@ -106,10 +106,9 @@ fn run_max_mem_benchmark() -> Result<HashMap<String, u64>> {
let proc_result = proc.wait_with_output()?;
println!("{proc_result:?}");
results.insert(
name.to_string(),
utils::parse_max_mem(benchmark_file).unwrap(),
);
if let Some(max_mem) = utils::parse_max_mem(benchmark_file)? {
results.insert(name.to_string(), max_mem);
}
}
Ok(results)
@@ -229,7 +228,7 @@ fn run_exec_time(target_dir: &Path) -> Result<HashMap<String, HashMap<String, f6
);
}
utils::run(&command.iter().map(|s| s.as_ref()).collect::<Vec<_>>());
utils::run(&command.iter().map(|s| s.as_ref()).collect::<Vec<_>>())?;
let mut results = HashMap::<String, HashMap<String, f64>>::new();
let hyperfine_results = utils::read_json(benchmark_file)?;
@@ -264,7 +263,7 @@ fn main() -> Result<()> {
utils::download_file(
"https://github.com/lemarier/tauri-test/releases/download/v2.0.0/json_3mb.json",
json_3mb,
);
)?;
}
println!("Starting tauri benchmark");
@@ -278,7 +277,7 @@ fn main() -> Result<()> {
let now = time::OffsetDateTime::now_utc();
let mut new_data = utils::BenchResult {
created_at: now.format(&format).unwrap(),
sha1: utils::run_collect(&["git", "rev-parse", "HEAD"])
sha1: utils::run_collect(&["git", "rev-parse", "HEAD"])?
.0
.trim()
.to_string(),

View File

@@ -96,9 +96,8 @@ pub fn home_path() -> PathBuf {
}
/// Get the root path of the Tauri repository.
/// Returns `None` if the parent path cannot be determined.
pub fn tauri_root_path() -> Option<PathBuf> {
bench_root_path().parent().map(|p| p.to_path_buf())
pub fn tauri_root_path() -> PathBuf {
bench_root_path().parent().map(|p| p.to_path_buf()).unwrap()
}
/// Run a command and collect its stdout and stderr as strings.