Skip to content

Commit 81d34b7

Browse files
committed
Version and lint
1 parent f5bc6d6 commit 81d34b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+616
-647
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@ profile_with_tracy = ["bevy/trace_tracy"]
7676
[dependencies]
7777
bevy = { workspace = true }
7878
bevy_mod_scripting_core = { workspace = true }
79-
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.12.0", optional = true }
80-
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.12.0", optional = true }
79+
bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.13.0", optional = true }
80+
bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.13.0", optional = true }
8181
# bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.9.0-alpha.2", optional = true }
8282
bevy_mod_scripting_functions = { workspace = true }
8383
bevy_mod_scripting_derive = { workspace = true }
8484

8585
[workspace.dependencies]
8686
profiling = { version = "1.0" }
8787
bevy = { version = "0.16.0", default-features = false }
88-
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.12.0" }
89-
bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.12.0", default-features = false }
90-
bevy_mod_scripting_derive = { path = "crates/bevy_mod_scripting_derive", version = "0.12.0" }
88+
bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.13.0" }
89+
bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.13.0", default-features = false }
90+
bevy_mod_scripting_derive = { path = "crates/bevy_mod_scripting_derive", version = "0.13.0" }
9191

9292
# test utilities
9393
script_integration_test_harness = { path = "crates/testing_crates/script_integration_test_harness" }

benches/benchmarks.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
use bevy::log::tracing_subscriber::layer::SubscriberExt;
2-
use bevy::log::{tracing, tracing_subscriber, Level};
3-
use bevy::reflect::Reflect;
1+
use std::{collections::HashMap, path::PathBuf, sync::LazyLock, time::Duration};
2+
3+
use bevy::{
4+
log::{
5+
tracing, tracing::span, tracing_subscriber, tracing_subscriber::layer::SubscriberExt, Level,
6+
},
7+
reflect::Reflect,
8+
};
49
use bevy_mod_scripting_core::bindings::{
510
FromScript, IntoScript, Mut, Ref, ReflectReference, ScriptValue, Val,
611
};
7-
use criterion::{criterion_main, measurement::Measurement, BenchmarkGroup, Criterion};
8-
use criterion::{BatchSize, BenchmarkFilter};
12+
use criterion::{
13+
criterion_main, measurement::Measurement, BatchSize, BenchmarkFilter, BenchmarkGroup, Criterion,
14+
};
915
use regex::Regex;
10-
use script_integration_test_harness::test_functions::rand::Rng;
1116
use script_integration_test_harness::{
1217
make_test_lua_plugin, make_test_rhai_plugin, perform_benchmark_with_generator,
1318
run_lua_benchmark, run_plugin_script_load_benchmark, run_rhai_benchmark,
19+
test_functions::rand::Rng,
1420
};
15-
use std::collections::HashMap;
16-
use std::{path::PathBuf, sync::LazyLock, time::Duration};
17-
use bevy::log::tracing::span;
1821
use test_utils::{discover_all_tests, Test};
1922

2023
extern crate bevy_mod_scripting;

crates/bevy_api_gen/src/bin/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#![feature(rustc_private)]
22
use std::{
3-
collections::HashMap,
4-
env,
5-
fs::{create_dir_all, File},
6-
io::{BufRead, Write},
7-
path::{Path, PathBuf},
8-
process::{Command, Stdio},
3+
collections::HashMap,
4+
env,
5+
fs::{create_dir_all, File},
6+
io::{BufRead, Write},
7+
path::{Path, PathBuf},
8+
process::{Command, Stdio},
99
};
1010

1111
use bevy_api_gen::*;

crates/bevy_api_gen/src/import_path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use indexmap::IndexMap;
22
use log::trace;
33
use rustc_hir::{
4-
def::DefKind,
5-
def_id::{CrateNum, DefId},
4+
def::DefKind,
5+
def_id::{CrateNum, DefId},
66
};
77
use rustc_middle::ty::TyCtxt;
88

crates/bevy_api_gen/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ pub use feature_graph::*;
3636
pub use meta::MetaLoader;
3737
pub use plugin::BevyAnalyzer;
3838
pub use template::{
39-
configure_tera, extend_context_with_args, Collect, Crate, TemplateKind, TEMPLATE_DIR,
39+
configure_tera, extend_context_with_args, Collect, Crate, TemplateKind, TEMPLATE_DIR,
4040
};

crates/bevy_api_gen/src/meta.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::{
2-
cell::RefCell,
3-
collections::HashMap,
4-
fs::File,
5-
io::{BufReader, BufWriter, Write},
2+
cell::RefCell,
3+
collections::HashMap,
4+
fs::File,
5+
io::{BufReader, BufWriter, Write},
66
};
77

88
use cargo_metadata::camino::Utf8PathBuf;

crates/bevy_api_gen/src/modifying_file_loader.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::{
2-
io,
3-
sync::{
4-
atomic::{AtomicBool, Ordering},
5-
Arc,
6-
},
2+
io,
3+
sync::{
4+
atomic::{AtomicBool, Ordering},
5+
Arc,
6+
},
77
};
88

99
use log::trace;

crates/bevy_api_gen/src/passes/cache_traits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use rustc_middle::ty::TyCtxt;
44
use rustc_span::Symbol;
55

66
use crate::{
7-
Args, BevyCtxt, DEF_PATHS_BMS_FROM_SCRIPT, DEF_PATHS_BMS_INTO_SCRIPT,
8-
DEF_PATHS_GET_TYPE_REGISTRATION, DEF_PATHS_REFLECT, STD_SOURCE_TRAITS,
7+
Args, BevyCtxt, DEF_PATHS_BMS_FROM_SCRIPT, DEF_PATHS_BMS_INTO_SCRIPT,
8+
DEF_PATHS_GET_TYPE_REGISTRATION, DEF_PATHS_REFLECT, STD_SOURCE_TRAITS,
99
};
1010

1111
fn dump_traits(tcx: &TyCtxt) -> String{

crates/bevy_api_gen/src/passes/codegen.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use crate::{configure_tera, Args, BevyCtxt, TemplateKind};
33
use log::info;
44
use rustc_hir::def_id::LOCAL_CRATE;
55
use std::{
6-
fs::{self, File},
7-
io::Write,
6+
fs::{self, File},
7+
io::Write,
88
};
99
use tera::Context;
1010

@@ -44,15 +44,15 @@ pub(crate) fn codegen(ctxt: &mut BevyCtxt<'_>, args: &Args) -> bool {
4444

4545
#[cfg(test)]
4646
mod tests {
47-
use std::collections::HashSet;
47+
use std::collections::HashSet;
4848

49-
use strum::VariantNames;
49+
use strum::VariantNames;
5050

51-
use crate::TEMPLATE_DIR;
51+
use crate::TEMPLATE_DIR;
5252

53-
use super::*;
53+
use super::*;
5454

55-
#[test]
55+
#[test]
5656
fn test_templates_exist() {
5757
let template_files: HashSet<&str> = TEMPLATE_DIR
5858
.files()

crates/bevy_api_gen/src/passes/find_methods_and_fields.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
use indexmap::IndexMap;
22
use log::{info, trace};
3+
use syn::Attribute;
34
use rustc_ast::Attribute;
45
use rustc_hir::{
5-
def_id::{DefId, LOCAL_CRATE},
6-
Safety,
6+
def_id::{DefId, LOCAL_CRATE},
7+
Safety,
78
};
89
use rustc_infer::infer::TyCtxtInferExt;
910
use rustc_middle::ty::{AdtKind, AssocKind, FieldDef, FnSig, Ty, TyCtxt, TyKind, TypingEnv};
1011
use rustc_span::Symbol;
1112
use rustc_trait_selection::infer::InferCtxtExt;
1213

1314
use crate::{
14-
Args, BevyCtxt, CachedTraits, FunctionContext, MetaLoader, ReflectType, ReflectionStrategy,
15+
Args, BevyCtxt, CachedTraits, FunctionContext, MetaLoader, ReflectType, ReflectionStrategy,
1516
};
1617

1718
/// Finds all methods and fields which can be wrapped on a proxy, stores them in sorted order.

crates/bevy_api_gen/src/passes/find_trait_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::collections::HashMap;
33
use log::trace;
44
use rustc_hir::def_id::DefId;
55
use rustc_infer::{
6-
infer::{InferCtxt, TyCtxtInferExt},
7-
traits::{Obligation, ObligationCause},
6+
infer::{InferCtxt, TyCtxtInferExt},
7+
traits::{Obligation, ObligationCause},
88
};
99
use rustc_middle::ty::{Ty, TypingEnv, TypingMode};
1010
use rustc_span::DUMMY_SP;

crates/bevy_api_gen/src/passes/populate_template_data.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
use std::{borrow::Cow, convert::identity};
22

33
use log::{trace, warn};
4+
use syn::Attribute;
45
use rustc_ast::Attribute;
56
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
67
use rustc_middle::ty::{
7-
AdtDef, FieldDef, GenericArg, GenericParamDefKind, TraitRef, Ty, TyKind, TypingEnv,
8+
AdtDef, FieldDef, GenericArg, GenericParamDefKind, TraitRef, Ty, TyKind, TypingEnv,
89
};
910
use rustc_span::Symbol;
1011

1112
use crate::{
12-
Arg, Args, BevyCtxt, Field, Function, FunctionContext, Item, Output, ReflectType,
13-
TemplateContext, Variant,
13+
Arg, Args, BevyCtxt, Field, Function, FunctionContext, Item, Output, ReflectType,
14+
TemplateContext, Variant,
1415
};
1516
/// Converts the BevyCtxt into simpler data that can be used in templates directly,
1617
/// Clears the BevyCtxt by clearing data structures after it uses them.

crates/bevy_mod_scripting_core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_mod_scripting_core"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
authors = ["Maksymilian Mozolewski <[email protected]>"]
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
@@ -32,7 +32,7 @@ rhai = { version = "1.21", default-features = false, features = [
3232
bevy = { workspace = true, default-features = false, features = ["bevy_asset", "std"] }
3333
parking_lot = "0.12.1"
3434
smallvec = "1.11"
35-
itertools = "0.13"
35+
itertools = "0.14"
3636
profiling = { workspace = true }
3737
bevy_mod_scripting_derive = { workspace = true }
3838
fixedbitset = "0.5"

crates/bevy_mod_scripting_core/src/asset.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
//! Systems and resources for handling script assets and events
22
3-
use crate::{
4-
commands::{CreateOrUpdateScript, DeleteScript},
5-
error::ScriptError,
6-
script::ScriptId,
7-
IntoScriptPluginParams, ScriptingSystemSet,
8-
};
3+
use std::borrow::Cow;
4+
95
use bevy::{
106
app::{App, PreUpdate},
117
asset::{Asset, AssetEvent, AssetId, AssetLoader, AssetPath, Assets},
12-
prelude::Resource,
138
log::{debug, info, trace, warn},
9+
platform::collections::HashMap,
1410
prelude::{
15-
Commands, Event, EventReader, EventWriter, Res,
16-
ResMut,
11+
Commands, Event, EventReader, EventWriter, IntoScheduleConfigs, Res, ResMut, Resource,
1712
},
1813
reflect::TypePath,
19-
platform::collections::HashMap,
2014
};
21-
use std::borrow::Cow;
22-
use bevy::prelude::IntoScheduleConfigs;
15+
16+
use crate::{
17+
commands::{CreateOrUpdateScript, DeleteScript},
18+
error::ScriptError,
19+
script::ScriptId,
20+
IntoScriptPluginParams, ScriptingSystemSet,
21+
};
2322

2423
/// Represents a scripting language. Languages which compile into another language should use the target language as their language.
2524
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]

crates/bevy_mod_scripting_core/src/bindings/access_map.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
use std::hash::{BuildHasherDefault, Hasher};
44

55
use bevy::{
6-
ecs::{component::ComponentId, world::unsafe_world_cell::UnsafeWorldCell},
7-
prelude::Resource,
8-
platform::collections::{HashMap, HashSet},
6+
ecs::{component::ComponentId, world::unsafe_world_cell::UnsafeWorldCell},
7+
platform::collections::{HashMap, HashSet},
8+
prelude::Resource,
99
};
1010
use parking_lot::Mutex;
1111
use smallvec::SmallVec;
@@ -822,11 +822,11 @@ pub(crate) use with_global_access;
822822

823823
#[cfg(test)]
824824
mod test {
825-
use std::hash::Hash;
825+
use std::hash::Hash;
826826

827-
use super::*;
827+
use super::*;
828828

829-
#[test]
829+
#[test]
830830
fn access_map_list_accesses() {
831831
let access_map = AccessMap::default();
832832

crates/bevy_mod_scripting_core/src/bindings/allocator.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
//! An allocator used to control the lifetime of allocations
22
3+
use bevy::prelude::Resource;
34
use bevy::{
4-
app::{App, Plugin, PostUpdate},
5-
diagnostic::{Diagnostic, DiagnosticPath, Diagnostics, RegisterDiagnostic},
6-
ecs::system::{Res},
7-
prelude::ResMut,
8-
reflect::PartialReflect,
9-
platform::collections::HashMap,
5+
app::{App, Plugin, PostUpdate},
6+
diagnostic::{Diagnostic, DiagnosticPath, Diagnostics, RegisterDiagnostic},
7+
ecs::system::Res,
8+
platform::collections::HashMap,
9+
prelude::ResMut,
10+
reflect::PartialReflect,
1011
};
1112
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
1213
use std::{
13-
cell::UnsafeCell,
14-
cmp::Ordering,
15-
fmt::{Display, Formatter},
16-
hash::Hasher,
17-
sync::{atomic::AtomicU64, Arc},
14+
cell::UnsafeCell,
15+
cmp::Ordering,
16+
fmt::{Display, Formatter},
17+
hash::Hasher,
18+
sync::{atomic::AtomicU64, Arc},
1819
};
19-
use bevy::prelude::Resource;
2020

2121
/// The path used for the total number of allocations diagnostic
2222
pub const ALLOCATOR_TOTAL_DIAG_PATH: DiagnosticPath =
@@ -261,9 +261,9 @@ impl Plugin for AllocatorDiagnosticPlugin {
261261

262262
#[cfg(test)]
263263
mod test {
264-
use super::*;
264+
use super::*;
265265

266-
#[test]
266+
#[test]
267267
fn test_reflect_allocator_garbage_clean() {
268268
let mut allocator = ReflectAllocator::default();
269269
let id = allocator.allocate(0);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
use std::{ffi::OsString, path::PathBuf};
44

55
use crate::{
6-
bindings::{ReflectReference, ScriptValue},
7-
docgen::TypedThrough, error::InteropError,
6+
bindings::{ReflectReference, ScriptValue},
7+
docgen::TypedThrough, error::InteropError,
88
};
99

1010
use super::{
11-
from::{FromScript, Mut, Ref, Union, Val},
12-
into::IntoScript,
13-
script_function::{DynamicScriptFunction, DynamicScriptFunctionMut, FunctionCallContext},
14-
type_dependencies::GetTypeDependencies,
11+
from::{FromScript, Mut, Ref, Union, Val},
12+
into::IntoScript,
13+
script_function::{DynamicScriptFunction, DynamicScriptFunctionMut, FunctionCallContext},
14+
type_dependencies::GetTypeDependencies,
1515
};
1616

1717
/// Marker trait for types that can be used as arguments to a script function.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//! Contains the [`FromScriptRef`] trait and its implementations.
22
33
use crate::{
4-
bindings::{match_by_type, FromScript, WorldGuard},
5-
error::InteropError,
6-
reflection_extensions::TypeInfoExtensions,
7-
ScriptValue,
4+
bindings::{match_by_type, FromScript, WorldGuard},
5+
error::InteropError,
6+
reflection_extensions::TypeInfoExtensions,
7+
ScriptValue,
88
};
99
use bevy::reflect::{
10-
DynamicEnum, DynamicList, DynamicMap, DynamicTuple, DynamicVariant, Map, PartialReflect,
10+
DynamicEnum, DynamicList, DynamicMap, DynamicTuple, DynamicVariant, Map, PartialReflect,
1111
};
1212
use std::{any::TypeId, ffi::OsString, path::PathBuf};
1313

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::{borrow::Cow, collections::HashMap, ffi::OsString, path::PathBuf};
55

66
use super::{DynamicScriptFunction, DynamicScriptFunctionMut, Union, Val};
77
use crate::{
8-
bindings::{ReflectReference, ScriptValue, WorldGuard},
9-
error::InteropError,
8+
bindings::{ReflectReference, ScriptValue, WorldGuard},
9+
error::InteropError,
1010
};
1111

1212
/// Converts a value into a [`ScriptValue`].

0 commit comments

Comments
 (0)