Skip to content

Commit b2f5212

Browse files
authored
Tidy up old SystemCondition trait hierarchy (#21844)
# Objective Cleanup code that was previously required in older rust versions but is no longer needed in newer versions. ## Solution [As of rust 1.79.0, we can put bounds on associated types directly](https://blog.rust-lang.org/2024/06/13/Rust-1.79.0/#bounds-in-associated-type-position), so lets do that for `SystemCondition`.
1 parent c4b6836 commit b2f5212

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

crates/bevy_ecs/src/schedule/condition.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub type BoxedCondition<In = ()> = Box<dyn ReadOnlySystem<In = In, Out = bool>>;
7373
/// # app.run(&mut world);
7474
/// # assert!(world.resource::<DidRun>().0);
7575
pub trait SystemCondition<Marker, In: SystemInput = ()>:
76-
sealed::SystemCondition<Marker, In>
76+
IntoSystem<In, bool, Marker, System: ReadOnlySystem>
7777
{
7878
/// Returns a new run condition that only returns `true`
7979
/// if both this one and the passed `and` return `true`.
@@ -373,30 +373,10 @@ pub trait SystemCondition<Marker, In: SystemInput = ()>:
373373
}
374374

375375
impl<Marker, In: SystemInput, F> SystemCondition<Marker, In> for F where
376-
F: sealed::SystemCondition<Marker, In>
376+
F: IntoSystem<In, bool, Marker, System: ReadOnlySystem>
377377
{
378378
}
379379

380-
mod sealed {
381-
use crate::system::{IntoSystem, ReadOnlySystem, SystemInput};
382-
383-
pub trait SystemCondition<Marker, In: SystemInput>:
384-
IntoSystem<In, bool, Marker, System = Self::ReadOnlySystem>
385-
{
386-
// This associated type is necessary to let the compiler
387-
// know that `Self::System` is `ReadOnlySystem`.
388-
type ReadOnlySystem: ReadOnlySystem<In = In, Out = bool>;
389-
}
390-
391-
impl<Marker, In: SystemInput, F> SystemCondition<Marker, In> for F
392-
where
393-
F: IntoSystem<In, bool, Marker>,
394-
F::System: ReadOnlySystem,
395-
{
396-
type ReadOnlySystem = F::System;
397-
}
398-
}
399-
400380
/// A collection of [run conditions](SystemCondition) that may be useful in any bevy app.
401381
pub mod common_conditions {
402382
use super::{NotSystem, SystemCondition};

0 commit comments

Comments
 (0)