Skip to content

Commit b6edf6e

Browse files
committed
Fix clippy
1 parent 8537bcd commit b6edf6e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

crates/bevy_reflect/src/serde/de.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<'a, 'de> Visitor<'de> for ReflectDeserializerVisitor<'a> {
8787

8888
match map.next_key::<&str>()? {
8989
Some(type_fields::VALUE) => {
90-
let registration = self.registry.get_with_name(&type_name).ok_or_else(|| {
90+
let registration = self.registry.get_with_name(type_name).ok_or_else(|| {
9191
de::Error::custom(format_args!("No registration found for {}", type_name))
9292
})?;
9393
let type_info = registration.type_info();
@@ -99,12 +99,10 @@ impl<'a, 'de> Visitor<'de> for ReflectDeserializerVisitor<'a> {
9999
}
100100
Some(type_fields::TYPE) => Err(de::Error::duplicate_field(type_fields::TYPE)),
101101
Some(field) => Err(de::Error::unknown_field(field, &[type_fields::VALUE])),
102-
None => {
103-
return Err(de::Error::invalid_length(
104-
0,
105-
&"two entries: `type` and `value`",
106-
));
107-
}
102+
None => Err(de::Error::invalid_length(
103+
0,
104+
&"two entries: `type` and `value`",
105+
)),
108106
}
109107
}
110108
}
@@ -462,6 +460,7 @@ mod tests {
462460
use bevy_utils::HashMap;
463461
use serde::de::DeserializeSeed;
464462
use serde::Deserialize;
463+
use std::f32::consts::PI;
465464

466465
#[derive(Reflect, FromReflect, Debug, PartialEq)]
467466
struct MyStruct {
@@ -526,7 +525,7 @@ mod tests {
526525
let expected = MyStruct {
527526
primitive_value: 123,
528527
option_value: Some(String::from("Hello world!")),
529-
tuple_value: (3.14, 1337),
528+
tuple_value: (PI, 1337),
530529
list_value: vec![-2, -1, 0, 1, 2],
531530
array_value: [-2, -1, 0, 1, 2],
532531
map_value: map,
@@ -544,7 +543,7 @@ mod tests {
544543
"primitive_value": 123,
545544
"option_value": Some("Hello world!"),
546545
"tuple_value": (
547-
3.14,
546+
3.1415927,
548547
1337,
549548
),
550549
"list_value": [

crates/bevy_reflect/src/serde/ser.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ mod tests {
260260
use crate::{Reflect, TypeRegistry};
261261
use bevy_utils::HashMap;
262262
use serde::Serialize;
263+
use std::f32::consts::PI;
263264

264265
#[derive(Reflect, Debug, PartialEq)]
265266
struct MyStruct {
@@ -311,7 +312,7 @@ mod tests {
311312
let input = MyStruct {
312313
primitive_value: 123,
313314
option_value: Some(String::from("Hello world!")),
314-
tuple_value: (3.14, 1337),
315+
tuple_value: (PI, 1337),
315316
list_value: vec![-2, -1, 0, 1, 2],
316317
array_value: [-2, -1, 0, 1, 2],
317318
map_value: map,
@@ -332,7 +333,7 @@ mod tests {
332333
"value": {
333334
"primitive_value": 123,
334335
"option_value": Some("Hello world!"),
335-
"tuple_value": (3.14, 1337),
336+
"tuple_value": (3.1415927, 1337),
336337
"list_value": [
337338
-2,
338339
-1,

0 commit comments

Comments
 (0)