eframe: don't prettify presisted ron strings (#902)

What ultimately ends up stored into a file is the
HashMap<String, String>, which when prettified only nets three
(depending on the settings) lines of "string": "long prettified
string that's really hard to read because of the extra indentation and
literal \n characters that are all just on one single line".

Not prettifying the values in the first place makes it somewhat easier
to read and also saves a bit of space.
This commit is contained in:
Alexander Chaplin Braz 2021-11-28 16:37:40 +01:00 committed by GitHub
parent 9d56bce592
commit 224d4d6d26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -413,10 +413,7 @@ pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &st
/// Serialize the given value as [RON](https://github.com/ron-rs/ron) and store with the given key. /// Serialize the given value as [RON](https://github.com/ron-rs/ron) and store with the given key.
#[cfg(feature = "ron")] #[cfg(feature = "ron")]
pub fn set_value<T: serde::Serialize>(storage: &mut dyn Storage, key: &str, value: &T) { pub fn set_value<T: serde::Serialize>(storage: &mut dyn Storage, key: &str, value: &T) {
storage.set_string( storage.set_string(key, ron::ser::to_string(value).unwrap());
key,
ron::ser::to_string_pretty(value, Default::default()).unwrap(),
);
} }
/// [`Storage`] key used for app /// [`Storage`] key used for app