Fix ron deprecation (#5021)

# Objective

- Update to fix `ron` deprecation
This commit is contained in:
François 2022-06-15 19:18:53 +00:00
parent 32cd9899c8
commit ab72c8368f
2 changed files with 3 additions and 13 deletions

View file

@ -871,7 +871,6 @@ bevy_reflect::tests::should_reflect_debug::Test {
#[cfg(feature = "glam")]
mod glam {
use super::*;
use ::serde::Serialize;
#[test]
fn vec3_serialization() {
@ -882,17 +881,11 @@ bevy_reflect::tests::should_reflect_debug::Test {
let ser = ReflectSerializer::new(&v, &registry);
let mut dest = vec![];
let mut serializer = ron::ser::Serializer::new(&mut dest, None, false)
.expect("Failed to acquire serializer");
ser.serialize(&mut serializer).expect("Failed to serialize");
let result = String::from_utf8(dest).expect("Failed to convert to string");
let result = ron::to_string(&ser).expect("Failed to serialize to string");
assert_eq!(
result,
r#"{"type":"glam::vec3::Vec3","struct":{"x":{"type":"f32","value":12},"y":{"type":"f32","value":3},"z":{"type":"f32","value":-6.9}}}"#
r#"{"type":"glam::vec3::Vec3","struct":{"x":{"type":"f32","value":12.0},"y":{"type":"f32","value":3.0},"z":{"type":"f32","value":-6.9}}}"#
);
}

View file

@ -151,8 +151,5 @@ where
.decimal_floats(true)
.indentor(" ".to_string())
.new_line("\n".to_string());
let mut buf = Vec::new();
let mut ron_serializer = ron::ser::Serializer::new(&mut buf, Some(pretty_config), false)?;
serialize.serialize(&mut ron_serializer)?;
Ok(String::from_utf8(buf).unwrap())
ron::ser::to_string_pretty(&serialize, pretty_config)
}