Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a939e93
Add `core` and `alloc` over `std` Lints
bushrat011899 Sep 18, 2024
120e9e0
Fixing issues raised by CI
bushrat011899 Sep 18, 2024
abb01eb
Bump MSRV
bushrat011899 Sep 18, 2024
864631f
Responding to CI issues
bushrat011899 Sep 18, 2024
145ab01
Switch `define_label` macro to `std` instead of `alloc`
bushrat011899 Sep 18, 2024
8a99654
Re-export `Box` to satisfy lint
bushrat011899 Sep 18, 2024
9e4c516
Fixed doctests
bushrat011899 Sep 18, 2024
273cd3a
Fixed compile check CI
bushrat011899 Sep 18, 2024
6960fd1
Fixed audio patch and formatting
bushrat011899 Sep 18, 2024
389310a
Remove `std` uses that `clippy` missed
bushrat011899 Sep 18, 2024
46aa899
Fixed typo in find-and-replace
bushrat011899 Sep 18, 2024
f3c95da
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 18, 2024
ecc8d33
Respond to lint in CI
bushrat011899 Sep 18, 2024
5c7fa79
One more `std::f32` crushed
bushrat011899 Sep 18, 2024
270a49f
Forgot to check `examples` for those pesky `std::f32`'s
bushrat011899 Sep 18, 2024
50e34bd
Allow examples to use the `std` crate
bushrat011899 Sep 18, 2024
a6780ba
Remove workspace lints from root crate
bushrat011899 Sep 18, 2024
e28ff2a
Added comment to `Cargo.toml`
bushrat011899 Sep 19, 2024
f62b660
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 19, 2024
6bbca4e
CI issues from merge
bushrat011899 Sep 19, 2024
cdbc80a
Fixed instances of redundant braces in `use` statements
bushrat011899 Sep 20, 2024
fff160e
Re-merge `std` imports
bushrat011899 Sep 20, 2024
4704134
Revert change in `tests` as it is not required
bushrat011899 Sep 20, 2024
a9e1664
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 20, 2024
12b5c66
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 20, 2024
e7efe08
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 21, 2024
b89e0d1
Remove double `std`'s
bushrat011899 Sep 21, 2024
7a2b7a5
Reverted to `std` for documentation
bushrat011899 Sep 21, 2024
de8b0d6
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 21, 2024
8e453c7
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 22, 2024
a377ecb
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 22, 2024
6534168
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 23, 2024
546abdc
Merge remote-tracking branch 'upstream/main' into UseCoreOrAlloc
bushrat011899 Sep 23, 2024
eb32baf
Fix some `no_std` incompatible imports
bushrat011899 Sep 25, 2024
ac9ac9c
Initial `no_std` version of `bevy_tasks`
bushrat011899 Sep 22, 2024
6e20849
`concurrent-queue`
bushrat011899 Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
42 changes: 40 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,53 @@ ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
ref_as_ptr = "warn"

std_instead_of_core = "warn"
std_instead_of_alloc = "warn"
alloc_instead_of_core = "warn"

[workspace.lints.rust]
missing_docs = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }
unsafe_code = "deny"
unsafe_op_in_unsafe_fn = "warn"
unused_qualifications = "warn"

[lints]
workspace = true
# Unfortunately, cargo does not currently support overriding workspace lints
# inside a particular crate. See https://github.com/rust-lang/cargo/issues/13157
#
# We require an override for cases like `std_instead_of_core`, which are intended
# for the library contributors and not for how users should consume Bevy.
# To ensure examples aren't subject to these lints, below is a duplication of the
# workspace lints, with the "overrides" applied.
#
# [lints]
# workspace = true

[lints.clippy]
doc_markdown = "warn"
manual_let_else = "warn"
match_same_arms = "warn"
redundant_closure_for_method_calls = "warn"
redundant_else = "warn"
semicolon_if_nothing_returned = "warn"
type_complexity = "allow"
undocumented_unsafe_blocks = "warn"
unwrap_or_default = "warn"

ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
ref_as_ptr = "warn"

std_instead_of_core = "allow"
std_instead_of_alloc = "allow"
alloc_instead_of_core = "allow"

[lints.rust]
missing_docs = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs_dep)'] }
unsafe_code = "deny"
unsafe_op_in_unsafe_fn = "warn"
unused_qualifications = "warn"

[features]
default = [
Expand Down
30 changes: 15 additions & 15 deletions benches/benches/bevy_ecs/change_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn generic_bench<P: Copy>(

fn all_added_detection_generic<T: Component + Default>(group: &mut BenchGroup, entity_count: u32) {
group.bench_function(
format!("{}_entities_{}", entity_count, std::any::type_name::<T>()),
format!("{}_entities_{}", entity_count, core::any::type_name::<T>()),
|bencher| {
bencher.iter_batched_ref(
|| {
Expand All @@ -110,8 +110,8 @@ fn all_added_detection_generic<T: Component + Default>(group: &mut BenchGroup, e

fn all_added_detection(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("all_added_detection");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
for &entity_count in ENTITIES_TO_BENCH_COUNT {
generic_bench(
&mut group,
Expand All @@ -129,7 +129,7 @@ fn all_changed_detection_generic<T: Component + Default + BenchModify>(
entity_count: u32,
) {
group.bench_function(
format!("{}_entities_{}", entity_count, std::any::type_name::<T>()),
format!("{}_entities_{}", entity_count, core::any::type_name::<T>()),
|bencher| {
bencher.iter_batched_ref(
|| {
Expand Down Expand Up @@ -158,8 +158,8 @@ fn all_changed_detection_generic<T: Component + Default + BenchModify>(

fn all_changed_detection(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("all_changed_detection");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
for &entity_count in ENTITIES_TO_BENCH_COUNT {
generic_bench(
&mut group,
Expand All @@ -179,7 +179,7 @@ fn few_changed_detection_generic<T: Component + Default + BenchModify>(
let ratio_to_modify = 0.1;
let amount_to_modify = (entity_count as f32 * ratio_to_modify) as usize;
group.bench_function(
format!("{}_entities_{}", entity_count, std::any::type_name::<T>()),
format!("{}_entities_{}", entity_count, core::any::type_name::<T>()),
|bencher| {
bencher.iter_batched_ref(
|| {
Expand Down Expand Up @@ -208,8 +208,8 @@ fn few_changed_detection_generic<T: Component + Default + BenchModify>(

fn few_changed_detection(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("few_changed_detection");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
for &entity_count in ENTITIES_TO_BENCH_COUNT {
generic_bench(
&mut group,
Expand All @@ -227,7 +227,7 @@ fn none_changed_detection_generic<T: Component + Default>(
entity_count: u32,
) {
group.bench_function(
format!("{}_entities_{}", entity_count, std::any::type_name::<T>()),
format!("{}_entities_{}", entity_count, core::any::type_name::<T>()),
|bencher| {
bencher.iter_batched_ref(
|| {
Expand All @@ -252,8 +252,8 @@ fn none_changed_detection_generic<T: Component + Default>(

fn none_changed_detection(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("none_changed_detection");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
for &entity_count in ENTITIES_TO_BENCH_COUNT {
generic_bench(
&mut group,
Expand Down Expand Up @@ -308,7 +308,7 @@ fn multiple_archetype_none_changed_detection_generic<T: Component + Default + Be
"{}_archetypes_{}_entities_{}",
archetype_count,
entity_count,
std::any::type_name::<T>()
core::any::type_name::<T>()
),
|bencher| {
bencher.iter_batched_ref(
Expand Down Expand Up @@ -356,8 +356,8 @@ fn multiple_archetype_none_changed_detection_generic<T: Component + Default + Be

fn multiple_archetype_none_changed_detection(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("multiple_archetypes_none_changed_detection");
group.warm_up_time(std::time::Duration::from_millis(800));
group.measurement_time(std::time::Duration::from_secs(8));
group.warm_up_time(core::time::Duration::from_millis(800));
group.measurement_time(core::time::Duration::from_secs(8));
for archetype_count in [5, 20, 100] {
for entity_count in [10, 100, 1000, 10000] {
multiple_archetype_none_changed_detection_generic::<Table>(
Expand Down
16 changes: 8 additions & 8 deletions benches/benches/bevy_ecs/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ criterion_group!(

fn add_remove(c: &mut Criterion) {
let mut group = c.benchmark_group("add_remove");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
group.bench_function("table", |b| {
let mut bench = add_remove_table::Benchmark::new();
b.iter(move || bench.run());
Expand All @@ -38,8 +38,8 @@ fn add_remove(c: &mut Criterion) {

fn add_remove_big(c: &mut Criterion) {
let mut group = c.benchmark_group("add_remove_big");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
group.bench_function("table", |b| {
let mut bench = add_remove_big_table::Benchmark::new();
b.iter(move || bench.run());
Expand All @@ -53,8 +53,8 @@ fn add_remove_big(c: &mut Criterion) {

fn add_remove_very_big(c: &mut Criterion) {
let mut group = c.benchmark_group("add_remove_very_big");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
group.bench_function("table", |b| {
let mut bench = add_remove_very_big_table::Benchmark::new();
b.iter(move || bench.run());
Expand All @@ -64,8 +64,8 @@ fn add_remove_very_big(c: &mut Criterion) {

fn insert_simple(c: &mut Criterion) {
let mut group = c.benchmark_group("insert_simple");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
group.bench_function("base", |b| {
let mut bench = insert_simple::Benchmark::new();
b.iter(move || bench.run());
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/events/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl<const SIZE: usize> Benchmark<SIZE> {
pub fn run(&mut self) {
let mut reader = self.0.get_cursor();
for evt in reader.read(&self.0) {
std::hint::black_box(evt);
core::hint::black_box(evt);
}
}
}
8 changes: 4 additions & 4 deletions benches/benches/bevy_ecs/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ criterion_group!(event_benches, send, iter);

fn send(c: &mut Criterion) {
let mut group = c.benchmark_group("events_send");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
for count in [100, 1000, 10000, 50000] {
group.bench_function(format!("size_4_events_{}", count), |b| {
let mut bench = send::Benchmark::<4>::new(count);
Expand All @@ -32,8 +32,8 @@ fn send(c: &mut Criterion) {

fn iter(c: &mut Criterion) {
let mut group = c.benchmark_group("events_iter");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
for count in [100, 1000, 10000, 50000] {
group.bench_function(format!("size_4_events_{}", count), |b| {
let mut bench = iter::Benchmark::<4>::new(count);
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/events/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<const SIZE: usize> Benchmark<SIZE> {
pub fn run(&mut self) {
for _ in 0..self.count {
self.events
.send(std::hint::black_box(BenchEvent([0u8; SIZE])));
.send(core::hint::black_box(BenchEvent([0u8; SIZE])));
}
self.events.update();
}
Expand Down
6 changes: 3 additions & 3 deletions benches/benches/bevy_ecs/fragmentation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bevy_ecs::prelude::*;
use bevy_ecs::system::SystemState;
use criterion::*;
use glam::*;
use std::hint::black_box;
use core::hint::black_box;

criterion_group!(fragmentation_benches, iter_frag_empty);

Expand All @@ -17,8 +17,8 @@ fn flip_coin() -> bool {
}
fn iter_frag_empty(c: &mut Criterion) {
let mut group = c.benchmark_group("iter_fragmented(4096)_empty");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));

group.bench_function("foreach_table", |b| {
let mut world = World::new();
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/bevy_ecs/iteration/heavy_compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub fn heavy_compute(c: &mut Criterion) {
struct Transform(Mat4);

let mut group = c.benchmark_group("heavy_compute");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
group.bench_function("base", |b| {
ComputeTaskPool::get_or_init(TaskPool::default);

Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/iteration/iter_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'w> Benchmark<'w> {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/iteration/iter_simple_foreach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'w> Benchmark<'w> {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'w> Benchmark<'w> {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'w> Benchmark<'w> {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Rotation(Vec3::X),
Position::<0>(Vec3::X),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'w> Benchmark<'w> {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Rotation(Vec3::X),
Position::<0>(Vec3::X),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'w> Benchmark<'w> {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/iteration/iter_simple_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Benchmark {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Position(Vec3::X),
Rotation(Vec3::X),
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/iteration/iter_simple_wide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'w> Benchmark<'w> {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Rotation(Vec3::X),
Position::<0>(Vec3::X),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'w> Benchmark<'w> {
let mut world = World::new();

world.spawn_batch(
std::iter::repeat((
core::iter::repeat((
Transform(Mat4::from_scale(Vec3::ONE)),
Rotation(Vec3::X),
Position::<0>(Vec3::X),
Expand Down
16 changes: 8 additions & 8 deletions benches/benches/bevy_ecs/iteration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ criterion_group!(

fn iter_simple(c: &mut Criterion) {
let mut group = c.benchmark_group("iter_simple");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
group.bench_function("base", |b| {
let mut bench = iter_simple::Benchmark::new();
b.iter(move || bench.run());
Expand Down Expand Up @@ -82,8 +82,8 @@ fn iter_simple(c: &mut Criterion) {

fn iter_frag(c: &mut Criterion) {
let mut group = c.benchmark_group("iter_fragmented");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
group.bench_function("base", |b| {
let mut bench = iter_frag::Benchmark::new();
b.iter(move || bench.run());
Expand All @@ -105,8 +105,8 @@ fn iter_frag(c: &mut Criterion) {

fn iter_frag_sparse(c: &mut Criterion) {
let mut group = c.benchmark_group("iter_fragmented_sparse");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
group.bench_function("base", |b| {
let mut bench = iter_frag_sparse::Benchmark::new();
b.iter(move || bench.run());
Expand All @@ -128,8 +128,8 @@ fn iter_frag_sparse(c: &mut Criterion) {

fn par_iter_simple(c: &mut Criterion) {
let mut group = c.benchmark_group("par_iter_simple");
group.warm_up_time(std::time::Duration::from_millis(500));
group.measurement_time(std::time::Duration::from_secs(4));
group.warm_up_time(core::time::Duration::from_millis(500));
group.measurement_time(core::time::Duration::from_secs(4));
for f in [0, 10, 100, 1000] {
group.bench_function(format!("with_{}_fragment", f), |b| {
let mut bench = par_iter_simple::Benchmark::new(f);
Expand Down
Loading