Skip to content

Commit

Permalink
Use crate: disqualified (#15372)
Browse files Browse the repository at this point in the history
# Objective

Fixes #15351 

## Solution

- Created new external crate and ported over the code

## Testing

- CI

## Migration guide

Replace references to `bevy_utils::ShortName` with
`disqualified::ShortName`.
  • Loading branch information
BenjaminBrienen authored Sep 23, 2024
1 parent 21da0b7 commit 8a6d0b0
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 230 deletions.
1 change: 1 addition & 0 deletions crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async-fs = "2.0"
async-lock = "3.0"
crossbeam-channel = "0.5"
downcast-rs = "1.2"
disqualified = "1.0"
futures-io = "0.3"
futures-lite = "2.0.1"
blake3 = "1.5"
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use crate::{
UntypedAssetId,
};
use bevy_ecs::prelude::*;
use bevy_reflect::{std_traits::ReflectDefault, Reflect, ShortName, TypePath};
use bevy_reflect::{std_traits::ReflectDefault, Reflect, TypePath};
use crossbeam_channel::{Receiver, Sender};
use disqualified::ShortName;
use std::{
any::TypeId,
hash::{Hash, Hasher},
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_ecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bevy_ecs_macros = { path = "macros", version = "0.15.0-dev" }
petgraph = "0.6"
bitflags = "2.3"
concurrent-queue = "2.4.0"
disqualified = "1.0"
fixedbitset = "0.5"
serde = { version = "1", optional = true, default-features = false }
thiserror = "1.0"
Expand Down
16 changes: 5 additions & 11 deletions crates/bevy_ecs/src/schedule/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use bevy_utils::{
tracing::{error, warn},
HashMap, HashSet,
};
use disqualified::ShortName;
use fixedbitset::FixedBitSet;
use petgraph::{algo::TarjanScc, prelude::*};
use thiserror::Error;
Expand Down Expand Up @@ -1607,16 +1608,11 @@ impl ScheduleGraph {
}
}
};
#[cfg(feature = "bevy_reflect")]
{
if self.settings.use_shortnames {
bevy_reflect::ShortName(&name).to_string()
} else {
name
}
if self.settings.use_shortnames {
ShortName(&name).to_string()
} else {
name
}
#[cfg(not(feature = "bevy_reflect"))]
name
}

fn anonymous_set_name(&self, id: &NodeId) -> String {
Expand Down Expand Up @@ -2018,7 +2014,6 @@ pub struct ScheduleBuildSettings {
/// If set to true, node names will be shortened instead of the fully qualified type path.
///
/// Defaults to `true`.
#[cfg(feature = "bevy_reflect")]
pub use_shortnames: bool,
/// If set to true, report all system sets the conflicting systems are part of.
///
Expand All @@ -2040,7 +2035,6 @@ impl ScheduleBuildSettings {
ambiguity_detection: LogLevel::Ignore,
hierarchy_detection: LogLevel::Warn,
auto_insert_apply_deferred: true,
#[cfg(feature = "bevy_reflect")]
use_shortnames: true,
report_sets: true,
}
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_hierarchy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [
"smallvec",
], optional = true }
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
disqualified = "1.0"

smallvec = { version = "1.11", features = ["union", "const_generics"] }

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_hierarchy/src/valid_parent_check_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::marker::PhantomData;
use crate::Parent;
use bevy_ecs::prelude::*;
#[cfg(feature = "bevy_app")]
use bevy_reflect::ShortName;
#[cfg(feature = "bevy_app")]
use bevy_utils::HashSet;
#[cfg(feature = "bevy_app")]
use disqualified::ShortName;

/// When enabled, runs [`check_hierarchy_component_has_valid_parent<T>`].
///
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_reflect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ bevy_ptr = { path = "../bevy_ptr", version = "0.15.0-dev" }

# other
erased-serde = "0.4"
disqualified = "1.0"
downcast-rs = "1.2"
thiserror = "1.0"
serde = "1"
Expand Down
3 changes: 1 addition & 2 deletions crates/bevy_reflect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ mod reflect;
mod reflectable;
mod remote;
mod set;
mod short_name;
mod struct_trait;
mod tuple;
mod tuple_struct;
Expand Down Expand Up @@ -623,7 +622,6 @@ pub use type_registry::*;

pub use bevy_reflect_derive::*;
pub use erased_serde;
pub use short_name::ShortName;

extern crate alloc;

Expand Down Expand Up @@ -680,6 +678,7 @@ pub mod __macro_exports {
mod tests {
use ::serde::{de::DeserializeSeed, Deserialize, Serialize};
use bevy_utils::HashMap;
use disqualified::ShortName;
use ron::{
ser::{to_string_pretty, PrettyConfig},
Deserializer,
Expand Down
214 changes: 0 additions & 214 deletions crates/bevy_reflect/src/short_name.rs

This file was deleted.

0 comments on commit 8a6d0b0

Please sign in to comment.