Skip to content

Commit

Permalink
Fix merge suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRega committed Mar 1, 2024
1 parent d685e55 commit ba894a7
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use image::{DynamicImage, Rgb};
use image_compare::{Algorithm, Metric, Similarity};
use schemars_derive::JsonSchema;
use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
use std::path::Path;
use thiserror::Error;
use tracing::error;

Expand Down Expand Up @@ -178,12 +178,6 @@ pub fn compare_paths<P: AsRef<Path>>(
}
};

let nominal_file_name =
get_file_name(nominal_path.as_ref()).ok_or(Error::FileNameParsing(format!(
"Could not extract filename from path {:?}",
nominal_path.as_ref()
)))?;
let out_path = (nominal_file_name + "diff_image.png").to_string();
let mut result_diff = report::Difference::new_for_file(&nominal_path, &actual_path);
if result.score < config.threshold {
let out_path_set = if let Some(i) = result.image {
Expand All @@ -199,15 +193,6 @@ pub fn compare_paths<P: AsRef<Path>>(
None
};

if result.score < config.threshold {
let out_path_set;
if let Some(i) = result.image {
i.save(PathBuf::from(&out_path))?;
out_path_set = Some(out_path);
} else {
out_path_set = None;
}

let error_message = format!(
"Diff for image {} was not met, expected {}, found {}",
nominal_path.as_ref().to_string_lossy(),
Expand Down

0 comments on commit ba894a7

Please sign in to comment.