Skip to content

Commit 247f2b1

Browse files
committed
run cargo fmt
1 parent 8575d93 commit 247f2b1

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

crates/bevy_ecs/src/change_detection.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//! Types that detect when their internal data mutate.
22
3-
use crate::{
4-
component::ComponentTicks, ptr::PtrMut, system::Resource,
5-
world::ThreadLocalResource,
6-
};
3+
use crate::{component::ComponentTicks, ptr::PtrMut, system::Resource, world::ThreadLocalResource};
74
#[cfg(feature = "bevy_reflect")]
85
use bevy_reflect::Reflect;
96
use std::ops::{Deref, DerefMut};

crates/bevy_ecs/src/system/system_param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use crate::{
55
change_detection::Ticks,
66
component::{Component, ComponentId, ComponentTicks, Components},
77
entity::{Entities, Entity},
8-
world::ThreadLocalResource,
98
query::{
109
Access, FilteredAccess, FilteredAccessSet, QueryState, ReadOnlyWorldQuery, WorldQuery,
1110
},
1211
system::{CommandQueue, Commands, Query, SystemMeta},
12+
world::ThreadLocalResource,
1313
world::{FromWorld, World},
1414
};
1515
pub use bevy_ecs_macros::SystemParam;

crates/bevy_ecs/src/world/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
mod entity_ref;
22
mod spawn_batch;
3-
mod world_cell;
43
mod thread_local_resource;
4+
mod world_cell;
55

66
pub use crate::change_detection::Mut;
77
pub use entity_ref::*;
88
pub use spawn_batch::*;
9-
pub use world_cell::*;
109
pub use thread_local_resource::*;
10+
pub use world_cell::*;
1111

1212
use crate::{
1313
archetype::{ArchetypeComponentId, ArchetypeComponentInfo, ArchetypeId, Archetypes},

crates/bevy_ecs/src/world/thread_local_resource.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use thread_local_object::ThreadLocal as ThreadLocalObject;
22

3-
43
// This is a thin wrapper around thread local to make some methods take &mut self.
54
// This makes accessing a &mut T require a NonSendMut from a system
65
// The underlying implementation panics if there are violations to rusts mutability rules.
@@ -26,40 +25,35 @@ impl<T: 'static> ThreadLocalResource<T> {
2625
{
2726
self.0.get(|t|
2827
// TODO: add typename to error message. possibly add reference to NonSend System param
29-
f(t.unwrap_or_else(||
28+
f(t.unwrap_or_else(||
3029
panic!(
3130
"Requested non-send resource {} does not exist on this thread.
3231
You may be on the wrong thread or need to call .set on the resource.",
3332
std::any::type_name::<R>()
3433
)
35-
))
36-
)
34+
)))
3735
}
3836

3937
pub fn get_mut<F, R>(&mut self, f: F) -> R
4038
where
4139
F: FnOnce(&mut T) -> R,
4240
{
43-
self.0.get_mut(|t|
41+
self.0.get_mut(|t|
4442
// TODO: add typename to error message. possibly add reference to NonSend System param
4543
f(t.unwrap_or_else(||
4644
panic!(
4745
"Requested non-send resource {} does not exist on this thread.
4846
You may be on the wrong thread or need to call .set on the resource.",
4947
std::any::type_name::<R>()
5048
)
51-
))
52-
)
49+
)))
5350
}
5451
}
5552

5653
impl<T: 'static + std::fmt::Debug> std::fmt::Debug for ThreadLocalResource<T> {
5754
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
58-
self.0.get(|field| {
59-
f.debug_tuple("ThreadLocalResource")
60-
.field(&field)
61-
.finish()
62-
})
55+
self.0
56+
.get(|field| f.debug_tuple("ThreadLocalResource").field(&field).finish())
6357
}
6458
}
6559

0 commit comments

Comments
 (0)