Skip to content

Commit dd34e41

Browse files
authored
chore: update ron to 0.12 (#819)
I made this update as part of updating `ron` in Debian and thought that you might like to have it upstream :)
1 parent af48633 commit dd34e41

File tree

3 files changed

+46
-22
lines changed

3 files changed

+46
-22
lines changed

Cargo.lock

Lines changed: 38 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

insta/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ csv = { version = "1.1.6", optional = true }
4848
console = { version = "0.15.4", optional = true, default-features = false }
4949
pest = { version = "2.1.3", optional = true }
5050
pest_derive = { version = "2.1.0", optional = true }
51-
ron = { version = "0.7.1", optional = true }
51+
ron = { version = "0.12.0", optional = true }
5252
toml = { version = "0.5.7", optional = true }
5353
globset = { version = ">= 0.4.6, < 0.4.17", optional = true }
5454
walkdir = { version = "2.3.1", optional = true }

insta/src/serialization.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use serde::de::value::Error as ValueError;
22
use serde::Serialize;
3+
#[cfg(feature = "ron")]
4+
use std::borrow::Cow;
35

46
use crate::content::{json, yaml, Content, ContentSerializer};
57
use crate::settings::Settings;
@@ -61,19 +63,19 @@ pub fn serialize_content(mut content: Content, format: SerializationFormat) -> S
6163
}
6264
#[cfg(feature = "ron")]
6365
SerializationFormat::Ron => {
64-
let mut buf = Vec::new();
66+
let mut buf = String::new();
6567
let mut config = ron::ser::PrettyConfig::new();
66-
config.new_line = "\n".to_string();
67-
config.indentor = " ".to_string();
68+
config.new_line = Cow::Borrowed("\n");
69+
config.indentor = Cow::Borrowed(" ");
6870
config.struct_names = true;
6971
let mut serializer = ron::ser::Serializer::with_options(
7072
&mut buf,
7173
Some(config),
72-
ron::options::Options::default(),
74+
&ron::options::Options::default(),
7375
)
7476
.unwrap();
7577
content.serialize(&mut serializer).unwrap();
76-
String::from_utf8(buf).unwrap()
78+
buf
7779
}
7880
#[cfg(feature = "toml")]
7981
SerializationFormat::Toml => {

0 commit comments

Comments
 (0)