Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Fix ron deprecation #5021

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}