1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
Description: Update ron to 0.12
Author: Antonin Delpeuch <antonin@delpeuch.eu>
Forwarded: https://github.com/mitsuhiko/insta/pull/819
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -145,7 +145,7 @@ optional = true
default-features = false
[dependencies.ron]
-version = "0.7.1"
+version = "0.12"
optional = true
[dependencies.serde]
--- a/src/serialization.rs
+++ b/src/serialization.rs
@@ -1,4 +1,5 @@
use serde::de::value::Error as ValueError;
+use std::borrow::Cow;
use serde::Serialize;
use crate::content::{json, yaml, Content, ContentSerializer};
@@ -63,19 +64,19 @@ pub fn serialize_content(mut content: Co
}
#[cfg(feature = "ron")]
SerializationFormat::Ron => {
- let mut buf = Vec::new();
+ let mut buf = String::new();
let mut config = ron::ser::PrettyConfig::new();
- config.new_line = "\n".to_string();
- config.indentor = " ".to_string();
+ config.new_line = Cow::Borrowed("\n");
+ config.indentor = Cow::Borrowed(" ");
config.struct_names = true;
let mut serializer = ron::ser::Serializer::with_options(
&mut buf,
Some(config),
- ron::options::Options::default(),
+ &ron::options::Options::default(),
)
.unwrap();
content.serialize(&mut serializer).unwrap();
- String::from_utf8(buf).unwrap()
+ buf
}
#[cfg(feature = "toml")]
SerializationFormat::Toml => {
|