Skip to content

Commit

Permalink
clippy: tests: Fix clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Aug 16, 2023
1 parent 4c19e91 commit 23ede85
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/criterion_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Default for Counter {
}
}

fn verify_file(dir: &PathBuf, path: &str) -> PathBuf {
fn verify_file(dir: &Path, path: &str) -> PathBuf {
let full_path = dir.join(path);
assert!(
full_path.is_file(),
Expand All @@ -64,36 +64,36 @@ fn verify_file(dir: &PathBuf, path: &str) -> PathBuf {
full_path
}

fn verify_json(dir: &PathBuf, path: &str) {
fn verify_json(dir: &Path, path: &str) {
let full_path = verify_file(dir, path);
let f = File::open(full_path).unwrap();
serde_json::from_reader::<File, Value>(f).unwrap();
}

#[cfg(feature = "html_reports")]
fn verify_svg(dir: &PathBuf, path: &str) {
fn verify_svg(dir: &Path, path: &str) {
verify_file(dir, path);
}

#[cfg(feature = "html_reports")]
fn verify_html(dir: &PathBuf, path: &str) {
fn verify_html(dir: &Path, path: &str) {
verify_file(dir, path);
}

fn verify_stats(dir: &PathBuf, baseline: &str) {
fn verify_stats(dir: &Path, baseline: &str) {
verify_json(dir, &format!("{}/estimates.json", baseline));
verify_json(dir, &format!("{}/sample.json", baseline));
verify_json(dir, &format!("{}/tukey.json", baseline));
verify_json(dir, &format!("{}/benchmark.json", baseline));
#[cfg(feature = "csv_output")]
verify_file(&dir, &format!("{}/raw.csv", baseline));
verify_file(dir, &format!("{}/raw.csv", baseline));
}

fn verify_not_exists(dir: &PathBuf, path: &str) {
fn verify_not_exists(dir: &Path, path: &str) {
assert!(!dir.join(path).exists());
}

fn latest_modified(dir: &PathBuf) -> SystemTime {
fn latest_modified(dir: &Path) -> SystemTime {
let mut newest_update: Option<SystemTime> = None;
for entry in WalkDir::new(dir) {
let entry = entry.unwrap();
Expand Down

0 comments on commit 23ede85

Please sign in to comment.