chiark
/
gitweb
/
~ian
/
mastodonochrome.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f972070
)
Append \n when we write out a JSON file.
author
Simon Tatham
<anakin@pobox.com>
Sat, 6 Jan 2024 13:10:38 +0000
(13:10 +0000)
committer
Simon Tatham
<anakin@pobox.com>
Sat, 6 Jan 2024 13:36:10 +0000
(13:36 +0000)
I just happened to notice that serde_json::to_string_pretty makes the
result pretty in every way except this one.
src/login.rs
patch
|
blob
|
history
diff --git
a/src/login.rs
b/src/login.rs
index 867d8020ca56b1c220df61fa03f66ccd436be84c..8a63d0362371cc07f2e0760b1d4afd29b928b8e7 100644
(file)
--- 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(())
}