Skip to content

Commit 0381a79

Browse files
authored
Delete System::component_access(). (#19496)
# Objective - Cleanup related to #19495. ## Solution - Delete `System::component_access()`. It is redundant with `System::component_access_set().combined_access()`. ## Testing - None. There are no callers of this function.
1 parent a4dd873 commit 0381a79

File tree

11 files changed

+22
-57
lines changed

11 files changed

+22
-57
lines changed

crates/bevy_ecs/src/schedule/executor/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
component::{ComponentId, Tick},
1919
error::{BevyError, ErrorContext, Result},
2020
prelude::{IntoSystemSet, SystemSet},
21-
query::{Access, FilteredAccessSet},
21+
query::FilteredAccessSet,
2222
schedule::{BoxedCondition, InternedSystemSet, NodeId, SystemTypeSet},
2323
system::{ScheduleSystem, System, SystemIn, SystemParamValidationError, SystemStateFlags},
2424
world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, World},
@@ -162,12 +162,8 @@ impl System for ApplyDeferred {
162162
Cow::Borrowed("bevy_ecs::apply_deferred")
163163
}
164164

165-
fn component_access(&self) -> &Access<ComponentId> {
166-
// This system accesses no components.
167-
const { &Access::new() }
168-
}
169-
170165
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
166+
// This system accesses no components.
171167
const { &FilteredAccessSet::new() }
172168
}
173169

crates/bevy_ecs/src/system/adapter_system.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ where
127127
self.name.clone()
128128
}
129129

130-
fn component_access(&self) -> &crate::query::Access<crate::component::ComponentId> {
131-
self.system.component_access()
132-
}
133-
134130
fn component_access_set(
135131
&self,
136132
) -> &crate::query::FilteredAccessSet<crate::component::ComponentId> {

crates/bevy_ecs/src/system/combinator.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use core::marker::PhantomData;
44
use crate::{
55
component::{ComponentId, Tick},
66
prelude::World,
7-
query::{Access, FilteredAccessSet},
7+
query::FilteredAccessSet,
88
schedule::InternedSystemSet,
99
system::{input::SystemInput, SystemIn, SystemParamValidationError},
1010
world::unsafe_world_cell::UnsafeWorldCell,
@@ -144,10 +144,6 @@ where
144144
self.name.clone()
145145
}
146146

147-
fn component_access(&self) -> &Access<ComponentId> {
148-
self.component_access_set.combined_access()
149-
}
150-
151147
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
152148
&self.component_access_set
153149
}
@@ -363,10 +359,6 @@ where
363359
self.name.clone()
364360
}
365361

366-
fn component_access(&self) -> &Access<ComponentId> {
367-
self.component_access_set.combined_access()
368-
}
369-
370362
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
371363
&self.component_access_set
372364
}

crates/bevy_ecs/src/system/exclusive_function_system.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
22
component::{ComponentId, Tick},
3-
query::{Access, FilteredAccessSet},
3+
query::FilteredAccessSet,
44
schedule::{InternedSystemSet, SystemSet},
55
system::{
66
check_system_change_tick, ExclusiveSystemParam, ExclusiveSystemParamItem, IntoSystem,
@@ -87,11 +87,6 @@ where
8787
self.system_meta.name.clone()
8888
}
8989

90-
#[inline]
91-
fn component_access(&self) -> &Access<ComponentId> {
92-
self.system_meta.component_access_set.combined_access()
93-
}
94-
9590
#[inline]
9691
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
9792
&self.system_meta.component_access_set

crates/bevy_ecs/src/system/function_system.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
component::{ComponentId, Tick},
33
prelude::FromWorld,
4-
query::{Access, FilteredAccessSet},
4+
query::FilteredAccessSet,
55
schedule::{InternedSystemSet, SystemSet},
66
system::{
77
check_system_change_tick, ReadOnlySystemParam, System, SystemIn, SystemInput, SystemParam,
@@ -620,11 +620,6 @@ where
620620
self.system_meta.name.clone()
621621
}
622622

623-
#[inline]
624-
fn component_access(&self) -> &Access<ComponentId> {
625-
self.system_meta.component_access_set.combined_access()
626-
}
627-
628623
#[inline]
629624
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
630625
&self.system_meta.component_access_set

crates/bevy_ecs/src/system/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,9 @@ mod tests {
11661166
x.initialize(&mut world);
11671167
y.initialize(&mut world);
11681168

1169-
let conflicts = x.component_access().get_conflicts(y.component_access());
1169+
let conflicts = x
1170+
.component_access_set()
1171+
.get_conflicts(y.component_access_set());
11701172
let b_id = world
11711173
.components()
11721174
.get_resource_id(TypeId::of::<B>())

crates/bevy_ecs/src/system/observer_system.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
error::Result,
77
never::Never,
88
prelude::{Bundle, Trigger},
9-
query::{Access, FilteredAccessSet},
9+
query::FilteredAccessSet,
1010
schedule::{Fallible, Infallible},
1111
system::{input::SystemIn, System},
1212
world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, World},
@@ -116,11 +116,6 @@ where
116116
self.observer.name()
117117
}
118118

119-
#[inline]
120-
fn component_access(&self) -> &Access<ComponentId> {
121-
self.observer.component_access()
122-
}
123-
124119
#[inline]
125120
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
126121
self.observer.component_access_set()

crates/bevy_ecs/src/system/schedule_system.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use alloc::{borrow::Cow, vec::Vec};
33
use crate::{
44
component::{ComponentId, Tick},
55
error::Result,
6-
query::{Access, FilteredAccessSet},
6+
query::FilteredAccessSet,
77
system::{input::SystemIn, BoxedSystem, System, SystemInput},
88
world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, FromWorld, World},
99
};
@@ -33,11 +33,6 @@ impl<S: System<In = ()>> System for InfallibleSystemWrapper<S> {
3333
self.0.type_id()
3434
}
3535

36-
#[inline]
37-
fn component_access(&self) -> &Access<ComponentId> {
38-
self.0.component_access()
39-
}
40-
4136
#[inline]
4237
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
4338
self.0.component_access_set()
@@ -154,10 +149,6 @@ where
154149
self.system.name()
155150
}
156151

157-
fn component_access(&self) -> &Access<ComponentId> {
158-
self.system.component_access()
159-
}
160-
161152
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
162153
self.system.component_access_set()
163154
}
@@ -256,10 +247,6 @@ where
256247
self.system.name()
257248
}
258249

259-
fn component_access(&self) -> &Access<ComponentId> {
260-
self.system.component_access()
261-
}
262-
263250
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
264251
self.system.component_access_set()
265252
}

crates/bevy_ecs/src/system/system.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use thiserror::Error;
99

1010
use crate::{
1111
component::{ComponentId, Tick},
12-
query::{Access, FilteredAccessSet},
12+
query::FilteredAccessSet,
1313
schedule::InternedSystemSet,
1414
system::{input::SystemInput, SystemIn},
1515
world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, World},
@@ -57,9 +57,6 @@ pub trait System: Send + Sync + 'static {
5757
TypeId::of::<Self>()
5858
}
5959

60-
/// Returns the system's component [`Access`].
61-
fn component_access(&self) -> &Access<ComponentId>;
62-
6360
/// Returns the system's component [`FilteredAccessSet`].
6461
fn component_access_set(&self) -> &FilteredAccessSet<ComponentId>;
6562

crates/bevy_ecs/src/world/unsafe_world_cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use thiserror::Error;
3636
///
3737
/// This alone is not enough to implement bevy systems where multiple systems can access *disjoint* parts of the world concurrently. For this, bevy stores all values of
3838
/// resources and components (and [`ComponentTicks`]) in [`UnsafeCell`]s, and carefully validates disjoint access patterns using
39-
/// APIs like [`System::component_access`](crate::system::System::component_access).
39+
/// APIs like [`System::component_access_set`](crate::system::System::component_access_set).
4040
///
4141
/// A system then can be executed using [`System::run_unsafe`](crate::system::System::run_unsafe) with a `&World` and use methods with interior mutability to access resource values.
4242
///

0 commit comments

Comments
 (0)