Skip to content

Commit

Permalink
Fix ron deprecation (#5021)
Browse files Browse the repository at this point in the history
# Objective

- Update to fix `ron` deprecation
  • Loading branch information
mockersf committed Jun 15, 2022
1 parent 32cd989 commit ab72c83
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
11 changes: 2 additions & 9 deletions crates/bevy_reflect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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}}}"#
);
}

Expand Down
5 changes: 1 addition & 4 deletions crates/bevy_scene/src/dynamic_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit ab72c83

Please sign in to comment.