Skip to content

Commit 8a26812

Browse files
committed
Deduplicate ambiguity reporting code (#6149)
# Objective Now that #6083 has been merged, we can clean up some ugly ambiguity detection code. # Solution Deduplicate code.
1 parent ac364e9 commit 8a26812

File tree

1 file changed

+9
-35
lines changed

1 file changed

+9
-35
lines changed

crates/bevy_ecs/src/schedule/ambiguity_detection.rs

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,42 +47,16 @@ impl SystemOrderAmbiguity {
4747
) -> Self {
4848
use SystemStageSegment::*;
4949

50-
// TODO: blocked on https://github.com/bevyengine/bevy/pull/4166
51-
// We can't grab the system container generically, because .parallel_systems()
52-
// and the exclusive equivalent return a different type,
53-
// and SystemContainer is not object-safe
54-
let (system_a_name, system_b_name) = match segment {
55-
Parallel => {
56-
let system_container = stage.parallel_systems();
57-
(
58-
system_container[system_a_index].name(),
59-
system_container[system_b_index].name(),
60-
)
61-
}
62-
ExclusiveAtStart => {
63-
let system_container = stage.exclusive_at_start_systems();
64-
(
65-
system_container[system_a_index].name(),
66-
system_container[system_b_index].name(),
67-
)
68-
}
69-
ExclusiveBeforeCommands => {
70-
let system_container = stage.exclusive_before_commands_systems();
71-
(
72-
system_container[system_a_index].name(),
73-
system_container[system_b_index].name(),
74-
)
75-
}
76-
ExclusiveAtEnd => {
77-
let system_container = stage.exclusive_at_end_systems();
78-
(
79-
system_container[system_a_index].name(),
80-
system_container[system_b_index].name(),
81-
)
82-
}
50+
let systems = match segment {
51+
Parallel => stage.parallel_systems(),
52+
ExclusiveAtStart => stage.exclusive_at_start_systems(),
53+
ExclusiveBeforeCommands => stage.exclusive_before_commands_systems(),
54+
ExclusiveAtEnd => stage.exclusive_at_end_systems(),
8355
};
84-
85-
let mut system_names = [system_a_name.to_string(), system_b_name.to_string()];
56+
let mut system_names = [
57+
systems[system_a_index].name().to_string(),
58+
systems[system_b_index].name().to_string(),
59+
];
8660
system_names.sort();
8761

8862
let mut conflicts: Vec<_> = component_ids

0 commit comments

Comments
 (0)