From 1947d179a319dcf76981a15bf02e40ee3193cc06 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 6 Jan 2024 13:10:38 +0000 Subject: [PATCH] Append \n when we write out a JSON file. I just happened to notice that serde_json::to_string_pretty makes the result pretty in every way except this one. --- src/login.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/login.rs b/src/login.rs index 867d802..8a63d03 100644 --- a/src/login.rs +++ b/src/login.rs @@ -212,7 +212,9 @@ pub fn login(cfgloc: &ConfigLocation, instance_url: &str, user_token: user_token.access_token, }; - cfgloc.create_file("auth", &serde_json::to_string_pretty(&auth).unwrap())?; + let mut json = serde_json::to_string_pretty(&auth).unwrap(); + json.push('\n'); + cfgloc.create_file("auth", &json)?; Ok(()) } -- 2.30.2