Skip to content

Commit c0d3f9d

Browse files
committed
chore(bench): fix build and clippy
1 parent d54f3b9 commit c0d3f9d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

bench/src/build_benchmark_jsons.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png",
1111
html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png"
1212
)]
13+
// file is used by multiple binaries
14+
#![allow(dead_code)]
1315

1416
use std::{fs::File, io::BufReader};
1517
mod utils;

bench/src/run_benchmark.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ fn run_max_mem_benchmark() -> Result<HashMap<String, u64>> {
106106

107107
let proc_result = proc.wait_with_output()?;
108108
println!("{proc_result:?}");
109-
results.insert(
110-
name.to_string(),
111-
utils::parse_max_mem(benchmark_file).unwrap(),
112-
);
109+
if let Some(max_mem) = utils::parse_max_mem(benchmark_file)? {
110+
results.insert(name.to_string(), max_mem);
111+
}
113112
}
114113

115114
Ok(results)
@@ -229,7 +228,7 @@ fn run_exec_time(target_dir: &Path) -> Result<HashMap<String, HashMap<String, f6
229228
);
230229
}
231230

232-
utils::run(&command.iter().map(|s| s.as_ref()).collect::<Vec<_>>());
231+
utils::run(&command.iter().map(|s| s.as_ref()).collect::<Vec<_>>())?;
233232

234233
let mut results = HashMap::<String, HashMap<String, f64>>::new();
235234
let hyperfine_results = utils::read_json(benchmark_file)?;
@@ -264,7 +263,7 @@ fn main() -> Result<()> {
264263
utils::download_file(
265264
"https://github.com/lemarier/tauri-test/releases/download/v2.0.0/json_3mb.json",
266265
json_3mb,
267-
);
266+
)?;
268267
}
269268

270269
println!("Starting tauri benchmark");
@@ -278,7 +277,7 @@ fn main() -> Result<()> {
278277
let now = time::OffsetDateTime::now_utc();
279278
let mut new_data = utils::BenchResult {
280279
created_at: now.format(&format).unwrap(),
281-
sha1: utils::run_collect(&["git", "rev-parse", "HEAD"])
280+
sha1: utils::run_collect(&["git", "rev-parse", "HEAD"])?
282281
.0
283282
.trim()
284283
.to_string(),

bench/src/utils.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ pub fn home_path() -> PathBuf {
9696
}
9797

9898
/// Get the root path of the Tauri repository.
99-
/// Returns `None` if the parent path cannot be determined.
100-
pub fn tauri_root_path() -> Option<PathBuf> {
101-
bench_root_path().parent().map(|p| p.to_path_buf())
99+
pub fn tauri_root_path() -> PathBuf {
100+
bench_root_path().parent().map(|p| p.to_path_buf()).unwrap()
102101
}
103102

104103
/// Run a command and collect its stdout and stderr as strings.

0 commit comments

Comments
 (0)