Skip to content

Commit

Permalink
Avoid collecting tool_config twice
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty committed Sep 25, 2024
1 parent 8753f2c commit 0a18177
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions insta/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,6 @@ pub fn assert_snapshot(
assertion_line,
)?;

let tool_config = get_tool_config(manifest_dir);

// apply filters if they are available
#[cfg(feature = "filters")]
let new_snapshot_value =
Expand Down Expand Up @@ -671,7 +669,7 @@ pub fn assert_snapshot(
.old_snapshot
.as_ref()
.map(|x| {
if tool_config.require_full_match() {
if ctx.tool_config.require_full_match() {
x.matches_fully(&new_snapshot)
} else {
x.matches(&new_snapshot)
Expand All @@ -683,7 +681,7 @@ pub fn assert_snapshot(
ctx.cleanup_passing()?;

if matches!(
tool_config.snapshot_update(),
ctx.tool_config.snapshot_update(),
crate::env::SnapshotUpdate::Force
) {
// Avoid creating new files if contents match exactly. In
Expand Down

0 comments on commit 0a18177

Please sign in to comment.