Skip to content

Commit

Permalink
applied rustfmt changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LaserWitch committed Sep 3, 2023
1 parent cc44e91 commit f1fc0e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
20 changes: 12 additions & 8 deletions bevy_script_api/src/common/bevy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ impl ScriptWorld {
) -> Result<ScriptRef, ScriptError> {
let mut w = self.write();

let mut entity_ref = w.get_entity_mut(entity).ok_or_else(|| {
ScriptError::Other(format!("Entity is not valid {:#?}", entity))})?;
let mut entity_ref = w
.get_entity_mut(entity)
.ok_or_else(|| ScriptError::Other(format!("Entity is not valid {:#?}", entity)))?;

let component_data = comp_type.data::<ReflectComponent>().ok_or_else(|| {
ScriptError::Other(format!("Not a component {}", comp_type.short_name()))
Expand Down Expand Up @@ -208,8 +209,9 @@ impl ScriptWorld {
) -> Result<Option<ScriptRef>, ScriptError> {
let w = self.read();

let entity_ref = w.get_entity(entity).ok_or_else(|| {
ScriptError::Other(format!("Entity is not valid {:#?}", entity))})?;
let entity_ref = w
.get_entity(entity)
.ok_or_else(|| ScriptError::Other(format!("Entity is not valid {:#?}", entity)))?;

let component_data = comp_type.data::<ReflectComponent>().ok_or_else(|| {
ScriptError::Other(format!("Not a component {}", comp_type.short_name()))
Expand All @@ -230,8 +232,9 @@ impl ScriptWorld {
ScriptError::Other(format!("Not a component {}", comp_type.short_name()))
})?;

let entity_ref = w.get_entity(entity).ok_or_else(|| {
ScriptError::Other(format!("Entity is not valid {:#?}", entity))})?;
let entity_ref = w
.get_entity(entity)
.ok_or_else(|| ScriptError::Other(format!("Entity is not valid {:#?}", entity)))?;

Ok(component_data.reflect(entity_ref).is_some())
}
Expand All @@ -243,8 +246,9 @@ impl ScriptWorld {
) -> Result<(), ScriptError> {
let mut w = self.write();

let mut entity_ref = w.get_entity_mut(entity).ok_or_else(|| {
ScriptError::Other(format!("Entity is not valid {:#?}", entity))})?;
let mut entity_ref = w
.get_entity_mut(entity)
.ok_or_else(|| ScriptError::Other(format!("Entity is not valid {:#?}", entity)))?;

let component_data = comp_type.data::<ReflectComponent>().ok_or_else(|| {
ScriptError::Other(format!("Not a component {}", comp_type.short_name()))
Expand Down
12 changes: 6 additions & 6 deletions bevy_script_api/src/sub_reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,12 @@ impl ReflectPath {
ReflectBase::Component { comp, entity } => {
let g = world_ptr.read();

let entity_ref = g.get_entity(*entity).ok_or_else(|| {
ReflectionError::InvalidBaseReference {
base: self.base.to_string(),
reason: "This entity does not exist".to_owned(),
}})?;

let entity_ref =
g.get_entity(*entity)
.ok_or_else(|| ReflectionError::InvalidBaseReference {
base: self.base.to_string(),
reason: "This entity does not exist".to_owned(),
})?;

let ref_ = self.walk_path(comp.reflect(entity_ref).ok_or_else(|| {
ReflectionError::InvalidBaseReference {
Expand Down

0 comments on commit f1fc0e5

Please sign in to comment.