-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add core
and alloc
over std
Lints
#15281
base: main
Are you sure you want to change the base?
Changes from 17 commits
a939e93
120e9e0
abb01eb
864631f
145ab01
8a99654
9e4c516
273cd3a
6960fd1
389310a
46aa899
f3c95da
ecc8d33
5c7fa79
270a49f
50e34bd
a6780ba
e28ff2a
f62b660
6bbca4e
cdbc80a
fff160e
4704134
a9e1664
12b5c66
e7efe08
b89e0d1
7a2b7a5
de8b0d6
8e453c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"] | |
license = "MIT OR Apache-2.0" | ||
repository = "https://github.com/bevyengine/bevy" | ||
documentation = "https://docs.rs/bevy" | ||
rust-version = "1.79.0" | ||
rust-version = "1.81.0" | ||
|
||
[workspace] | ||
exclude = [ | ||
|
@@ -45,15 +45,42 @@ 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" | ||
Comment on lines
+48
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These lints direct Bevy contributors to use |
||
|
||
[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 | ||
Comment on lines
-55
to
-56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We explicitly don't want examples to be subject to the same linting requirements as the rest of Bevy, since it is encouraged that users rely on the Rust There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment to this effect here and in the workspace lints to reduce the risk of desync. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
[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 = [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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>()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most changes look like this, where some inline call to a |
||
|bencher| { | ||
bencher.iter_batched_ref( | ||
|| { | ||
|
@@ -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, | ||
|
@@ -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( | ||
|| { | ||
|
@@ -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, | ||
|
@@ -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( | ||
|| { | ||
|
@@ -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, | ||
|
@@ -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( | ||
|| { | ||
|
@@ -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, | ||
|
@@ -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( | ||
|
@@ -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>( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required for
core::error::Error