Skip to content

Commit f811df5

Browse files
committed
fmt
1 parent c85c1c5 commit f811df5

File tree

5 files changed

+32
-39
lines changed

5 files changed

+32
-39
lines changed

crates/bevy_mod_scripting_core/src/bindings/function/into.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use std::{
2-
borrow::Cow,
3-
ffi::OsString,
4-
path::PathBuf,
5-
};
1+
use std::{borrow::Cow, ffi::OsString, path::PathBuf};
62

73
use bevy::reflect::PartialReflect;
84

crates/bevy_mod_scripting_core/src/bindings/function/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
pub mod from;
32
pub mod from_ref;
43
pub mod into;

crates/bevy_mod_scripting_functions/src/core.rs

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
//! Contains functions defined by the [`bevy_mod_scripting_core`] crate
22
33
use crate::NamespaceBuilder;
4-
use reflection_extensions::{PartialReflectExt, TypeIdExtensions};
54
use bevy::{
65
prelude::*,
7-
reflect::{
8-
func::FunctionRegistrationError, ParsedPath
9-
},
6+
reflect::{func::FunctionRegistrationError, ParsedPath},
107
};
118
use bevy_mod_scripting_core::*;
129
use bindings::{
13-
access_map::ReflectAccessId, function::{
10+
access_map::ReflectAccessId,
11+
function::{
1412
from::{Ref, Val},
1513
from_ref::FromScriptRef,
1614
into_ref::IntoScriptRef,
1715
script_function::{CallerContext, ScriptFunctionMut},
18-
}, pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, ScriptTypeRegistration, WorldCallbackAccess
16+
},
17+
pretty_print::DisplayWithWorld,
18+
script_value::ScriptValue,
19+
ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult,
20+
ScriptTypeRegistration, WorldCallbackAccess,
1921
};
2022
use error::InteropError;
21-
23+
use reflection_extensions::{PartialReflectExt, TypeIdExtensions};
2224

2325
pub fn register_bevy_bindings(app: &mut App) {
2426
#[cfg(feature = "bevy_bindings")]
@@ -134,29 +136,24 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat
134136
.register("has_entity", |s: WorldCallbackAccess, e: Val<Entity>| {
135137
s.has_entity(*e)
136138
})
137-
.register(
138-
"query",
139-
|| {
140-
let query_builder = ScriptQueryBuilder::default();
141-
Ok(Val(query_builder))
142-
},
143-
)
139+
.register("query", || {
140+
let query_builder = ScriptQueryBuilder::default();
141+
Ok(Val(query_builder))
142+
})
144143
.register("exit", |s: WorldCallbackAccess| s.exit())
145144
.register("log_all_allocations", |s: WorldCallbackAccess| {
146145
let world = s.try_read().expect("stale world");
147146
let allocator = world.allocator();
148147
let allocator = allocator.read();
149-
for (id,_) in allocator.iter_allocations() {
148+
for (id, _) in allocator.iter_allocations() {
150149
let raid = ReflectAccessId::for_allocation(id.clone());
151150
if world.claim_read_access(raid) {
152151
// Safety: ref released above
153152
unsafe { world.release_access(raid) };
154153
} else {
155154
panic!("Failed to claim read access for allocation id: {}", id.id());
156155
}
157-
158156
}
159-
160157
});
161158
Ok(())
162159
}
@@ -338,7 +335,6 @@ pub fn register_reflect_reference_functions(
338335
Ok(())
339336
}
340337

341-
342338
pub fn register_script_type_registration_functions(
343339
registry: &mut World,
344340
) -> Result<(), FunctionRegistrationError> {
@@ -360,11 +356,14 @@ pub fn register_script_query_builder_functions(
360356
registry: &mut World,
361357
) -> Result<(), FunctionRegistrationError> {
362358
NamespaceBuilder::<ScriptQueryBuilder>::new(registry)
363-
.register("component", |s: Val<ScriptQueryBuilder>, components: Val<ScriptTypeRegistration>| {
364-
let mut builder = s.into_inner();
365-
builder.component(components.into_inner());
366-
Val(builder)
367-
})
359+
.register(
360+
"component",
361+
|s: Val<ScriptQueryBuilder>, components: Val<ScriptTypeRegistration>| {
362+
let mut builder = s.into_inner();
363+
builder.component(components.into_inner());
364+
Val(builder)
365+
},
366+
)
368367
.register(
369368
"with",
370369
|s: Val<ScriptQueryBuilder>, with: Val<ScriptTypeRegistration>| {
@@ -409,23 +408,23 @@ pub fn register_core_functions(app: &mut App) {
409408
// we don't exclude from compilation here,
410409
// since these are much smaller and still useful if not included initially
411410
// perhaps people might want to include some but not all of these
412-
413-
#[cfg(feature="core_functions")]
411+
412+
#[cfg(feature = "core_functions")]
414413
register_world_functions(world).expect("Failed to register world functions");
415414

416-
#[cfg(feature="core_functions")]
415+
#[cfg(feature = "core_functions")]
417416
register_reflect_reference_functions(world)
418417
.expect("Failed to register reflect reference functions");
419418

420-
#[cfg(feature="core_functions")]
419+
#[cfg(feature = "core_functions")]
421420
register_script_type_registration_functions(world)
422421
.expect("Failed to register script type registration functions");
423422

424-
#[cfg(feature="core_functions")]
423+
#[cfg(feature = "core_functions")]
425424
register_script_query_builder_functions(world)
426425
.expect("Failed to register script query builder functions");
427426

428-
#[cfg(feature="core_functions")]
427+
#[cfg(feature = "core_functions")]
429428
register_script_query_result_functions(world)
430429
.expect("Failed to register script query result functions");
431430
}

crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use bevy_mod_scripting_core::{
77
CallScriptFunction,
88
},
99
pretty_print::DisplayWithWorld,
10-
script_value::ScriptValue, ReflectReference, WorldGuard,
10+
script_value::ScriptValue,
11+
ReflectReference, WorldGuard,
1112
},
1213
error::InteropError,
1314
reflection_extensions::TypeIdExtensions,

crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
use std::sync::Arc;
22

3-
43
use bevy_mod_scripting_core::bindings::WorldGuard;
5-
use bevy_mod_scripting_core::error::InteropError;
64
use bevy_mod_scripting_core::bindings::{WorldAccessGuard, WorldCallbackAccess};
5+
use bevy_mod_scripting_core::error::InteropError;
76
use mlua::UserData;
87

9-
108
#[derive(Clone, Debug, mlua::FromLua)]
119
pub struct LuaWorld(pub WorldCallbackAccess);
1210

0 commit comments

Comments
 (0)