From f0717da8d6cbf60061f2242703ef9da555b36325 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 28 Jan 2022 09:39:11 +0100 Subject: [PATCH] Do not emit extra newline after metadata --- CHANGELOG.md | 4 ++++ src/snapshot.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c4e2ce1..a1622928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to insta and cargo-insta are documented here. +## 1.13.0 + +- Fixed a bug where an extra newline was emitted following the snapshot header. + ## 1.12.0 - Add support for sorting redactions (`sorted_redaction` and `Settings::sort_selector`). (#212) diff --git a/src/snapshot.rs b/src/snapshot.rs index 1f79a7af..987909c2 100644 --- a/src/snapshot.rs +++ b/src/snapshot.rs @@ -274,7 +274,7 @@ impl Snapshot { } let mut f = fs::File::create(&path)?; serde_yaml::to_writer(&mut f, &self.metadata)?; - f.write_all(b"\n---\n")?; + f.write_all(b"---\n")?; f.write_all(self.contents_str().as_bytes())?; f.write_all(b"\n")?; Ok(())