Skip to content

Commit b06f603

Browse files
committed
update bevy_ecs msrv to 1.89
1 parent 35b16db commit b06f603

File tree

9 files changed

+73
-75
lines changed

9 files changed

+73
-75
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
1010
license = "MIT OR Apache-2.0"
1111
repository = "https://github.com/bevyengine/bevy"
1212
documentation = "https://docs.rs/bevy"
13-
rust-version = "1.88.0"
13+
rust-version = "1.89.0"
1414

1515
[workspace]
1616
resolver = "2"

crates/bevy_ecs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository = "https://github.com/bevyengine/bevy"
88
license = "MIT OR Apache-2.0"
99
keywords = ["ecs", "game", "bevy"]
1010
categories = ["game-engines", "data-structures"]
11-
rust-version = "1.86.0"
11+
rust-version = "1.89.0"
1212

1313
[features]
1414
default = ["std", "bevy_reflect", "async_executor", "backtrace"]

crates/bevy_ecs/src/component/clone.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,18 @@ pub fn component_clone_via_reflect(source: &SourceComponent, ctx: &mut Component
110110
// Try to clone using ReflectFromReflect
111111
if let Some(reflect_from_reflect) =
112112
registry.get_type_data::<bevy_reflect::ReflectFromReflect>(type_id)
113-
{
114-
if let Some(mut component) =
113+
&& let Some(mut component) =
115114
reflect_from_reflect.from_reflect(source_component_reflect.as_partial_reflect())
115+
{
116+
if let Some(reflect_component) =
117+
registry.get_type_data::<crate::reflect::ReflectComponent>(type_id)
116118
{
117-
if let Some(reflect_component) =
118-
registry.get_type_data::<crate::reflect::ReflectComponent>(type_id)
119-
{
120-
reflect_component.map_entities(&mut *component, ctx.entity_mapper());
121-
}
122-
drop(registry);
123-
124-
ctx.write_target_component_reflect(component);
125-
return;
119+
reflect_component.map_entities(&mut *component, ctx.entity_mapper());
126120
}
121+
drop(registry);
122+
123+
ctx.write_target_component_reflect(component);
124+
return;
127125
}
128126
// Else, try to clone using ReflectDefault
129127
if let Some(reflect_default) =

crates/bevy_ecs/src/entity/clone_entities.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,11 +1139,11 @@ impl OptOut {
11391139
#[inline]
11401140
fn filter_deny(&mut self, id: ComponentId, world: &World) {
11411141
self.deny.insert(id);
1142-
if self.attach_required_by_components {
1143-
if let Some(required_by) = world.components().get_required_by(id) {
1144-
self.deny.extend(required_by.iter());
1145-
};
1146-
}
1142+
if self.attach_required_by_components
1143+
&& let Some(required_by) = world.components().get_required_by(id)
1144+
{
1145+
self.deny.extend(required_by.iter());
1146+
};
11471147
}
11481148
}
11491149

crates/bevy_ecs/src/error/bevy_error.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ mod tests {
191191

192192
// On mac backtraces can start with Backtrace::create
193193
let mut skip = false;
194-
if let Some(line) = lines.peek() {
195-
if &line[6..] == "std::backtrace::Backtrace::create" {
196-
skip = true;
197-
}
194+
if let Some(line) = lines.peek()
195+
&& &line[6..] == "std::backtrace::Backtrace::create"
196+
{
197+
skip = true;
198198
}
199199

200200
if skip {
@@ -212,10 +212,10 @@ mod tests {
212212
let line = lines.next().unwrap();
213213
assert_eq!(&line[6..], expected);
214214
let mut skip = false;
215-
if let Some(line) = lines.peek() {
216-
if line.starts_with(" at") {
217-
skip = true;
218-
}
215+
if let Some(line) = lines.peek()
216+
&& line.starts_with(" at")
217+
{
218+
skip = true;
219219
}
220220

221221
if skip {
@@ -225,19 +225,20 @@ mod tests {
225225

226226
// on linux there is a second call_once
227227
let mut skip = false;
228-
if let Some(line) = lines.peek() {
229-
if &line[6..] == "core::ops::function::FnOnce::call_once" {
230-
skip = true;
231-
}
228+
if let Some(line) = lines.peek()
229+
&& &line[6..] == "core::ops::function::FnOnce::call_once"
230+
{
231+
skip = true;
232232
}
233+
233234
if skip {
234235
lines.next().unwrap();
235236
}
236237
let mut skip = false;
237-
if let Some(line) = lines.peek() {
238-
if line.starts_with(" at") {
239-
skip = true;
240-
}
238+
if let Some(line) = lines.peek()
239+
&& line.starts_with(" at")
240+
{
241+
skip = true;
241242
}
242243

243244
if skip {

crates/bevy_ecs/src/observer/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,18 +229,18 @@ impl World {
229229
&& observers.entity_component_observers.is_empty()
230230
{
231231
cache.component_observers.remove(component);
232-
if let Some(flag) = Observers::is_archetype_cached(event_key) {
233-
if let Some(by_component) = archetypes.by_component.get(component) {
234-
for archetype in by_component.keys() {
235-
let archetype = &mut archetypes.archetypes[archetype.index()];
236-
if archetype.contains(*component) {
237-
let no_longer_observed = archetype
238-
.iter_components()
239-
.all(|id| !cache.component_observers.contains_key(&id));
240-
241-
if no_longer_observed {
242-
archetype.flags.set(flag, false);
243-
}
232+
if let Some(flag) = Observers::is_archetype_cached(event_key)
233+
&& let Some(by_component) = archetypes.by_component.get(component)
234+
{
235+
for archetype in by_component.keys() {
236+
let archetype = &mut archetypes.archetypes[archetype.index()];
237+
if archetype.contains(*component) {
238+
let no_longer_observed = archetype
239+
.iter_components()
240+
.all(|id| !cache.component_observers.contains_key(&id));
241+
242+
if no_longer_observed {
243+
archetype.flags.set(flag, false);
244244
}
245245
}
246246
}

crates/bevy_ecs/src/query/fetch.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,10 +3208,10 @@ mod tests {
32083208

32093209
fn system(query: Query<EntityRef>) {
32103210
for entity_ref in &query {
3211-
if let Some(c) = entity_ref.get_ref::<C>() {
3212-
if !c.is_added() {
3213-
panic!("Expected C to be added");
3214-
}
3211+
if let Some(c) = entity_ref.get_ref::<C>()
3212+
&& !c.is_added()
3213+
{
3214+
panic!("Expected C to be added");
32153215
}
32163216
}
32173217
}

crates/bevy_ecs/src/relationship/mod.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -186,28 +186,27 @@ pub trait Relationship: Component + Sized {
186186
}
187187
}
188188
let target_entity = world.entity(entity).get::<Self>().unwrap().get();
189-
if let Ok(mut target_entity_mut) = world.get_entity_mut(target_entity) {
190-
if let Some(mut relationship_target) =
189+
if let Ok(mut target_entity_mut) = world.get_entity_mut(target_entity)
190+
&& let Some(mut relationship_target) =
191191
target_entity_mut.get_mut::<Self::RelationshipTarget>()
192-
{
193-
relationship_target.collection_mut_risky().remove(entity);
194-
if relationship_target.len() == 0 {
195-
let command = |mut entity: EntityWorldMut| {
196-
// this "remove" operation must check emptiness because in the event that an identical
197-
// relationship is inserted on top, this despawn would result in the removal of that identical
198-
// relationship ... not what we want!
199-
if entity
200-
.get::<Self::RelationshipTarget>()
201-
.is_some_and(RelationshipTarget::is_empty)
202-
{
203-
entity.remove::<Self::RelationshipTarget>();
204-
}
205-
};
206-
207-
world
208-
.commands()
209-
.queue_silenced(command.with_entity(target_entity));
210-
}
192+
{
193+
relationship_target.collection_mut_risky().remove(entity);
194+
if relationship_target.len() == 0 {
195+
let command = |mut entity: EntityWorldMut| {
196+
// this "remove" operation must check emptiness because in the event that an identical
197+
// relationship is inserted on top, this despawn would result in the removal of that identical
198+
// relationship ... not what we want!
199+
if entity
200+
.get::<Self::RelationshipTarget>()
201+
.is_some_and(RelationshipTarget::is_empty)
202+
{
203+
entity.remove::<Self::RelationshipTarget>();
204+
}
205+
};
206+
207+
world
208+
.commands()
209+
.queue_silenced(command.with_entity(target_entity));
211210
}
212211
}
213212
}

crates/bevy_ecs/src/system/system.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,10 @@ where
442442
// Note that the `downcast_mut` check is based on the static type,
443443
// and can be optimized out after monomorphization.
444444
let any: &mut dyn Any = &mut value;
445-
if let Some(err) = any.downcast_mut::<SystemParamValidationError>() {
446-
if err.skipped {
447-
return Self::Skipped(core::mem::replace(err, SystemParamValidationError::EMPTY));
448-
}
445+
if let Some(err) = any.downcast_mut::<SystemParamValidationError>()
446+
&& err.skipped
447+
{
448+
return Self::Skipped(core::mem::replace(err, SystemParamValidationError::EMPTY));
449449
}
450450
Self::Failed(From::from(value))
451451
}

0 commit comments

Comments
 (0)