diff --git a/insta/src/env.rs b/insta/src/env.rs index 807f8d36..776ef8b0 100644 --- a/insta/src/env.rs +++ b/insta/src/env.rs @@ -480,7 +480,7 @@ impl std::str::FromStr for UnreferencedSnapshots { } } -/// Memoizes a snapshot file in the reference file. +/// Memoizes a snapshot file in the reference file, as part of removing unreferenced snapshots. pub fn memoize_snapshot_file(snapshot_file: &Path) { if let Ok(path) = env::var("INSTA_SNAPSHOT_REFERENCES_FILE") { let mut f = fs::OpenOptions::new() diff --git a/insta/src/runtime.rs b/insta/src/runtime.rs index 85af0dba..32bc4292 100644 --- a/insta/src/runtime.rs +++ b/insta/src/runtime.rs @@ -651,7 +651,7 @@ pub fn assert_snapshot( let new_snapshot = ctx.new_snapshot(SnapshotContents::new(new_snapshot_value.into(), kind), expr); - // memoize the snapshot file if requested. + // memoize the snapshot file if requested, as part of potentially removing unreferenced snapshots if let Some(ref snapshot_file) = ctx.snapshot_file { memoize_snapshot_file(snapshot_file); }