Upgrade to Rust 1.88 (#19825)
This commit is contained in:
parent
35f1af522a
commit
92e65d5eb1
@ -10,19 +10,19 @@ fn send(c: &mut Criterion) {
|
||||
group.warm_up_time(core::time::Duration::from_millis(500));
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
for count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("size_4_events_{}", count), |b| {
|
||||
group.bench_function(format!("size_4_events_{count}"), |b| {
|
||||
let mut bench = send::Benchmark::<4>::new(count);
|
||||
b.iter(move || bench.run());
|
||||
});
|
||||
}
|
||||
for count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("size_16_events_{}", count), |b| {
|
||||
group.bench_function(format!("size_16_events_{count}"), |b| {
|
||||
let mut bench = send::Benchmark::<16>::new(count);
|
||||
b.iter(move || bench.run());
|
||||
});
|
||||
}
|
||||
for count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("size_512_events_{}", count), |b| {
|
||||
group.bench_function(format!("size_512_events_{count}"), |b| {
|
||||
let mut bench = send::Benchmark::<512>::new(count);
|
||||
b.iter(move || bench.run());
|
||||
});
|
||||
@ -35,19 +35,19 @@ fn iter(c: &mut Criterion) {
|
||||
group.warm_up_time(core::time::Duration::from_millis(500));
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
for count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("size_4_events_{}", count), |b| {
|
||||
group.bench_function(format!("size_4_events_{count}"), |b| {
|
||||
let mut bench = iter::Benchmark::<4>::new(count);
|
||||
b.iter(move || bench.run());
|
||||
});
|
||||
}
|
||||
for count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("size_16_events_{}", count), |b| {
|
||||
group.bench_function(format!("size_16_events_{count}"), |b| {
|
||||
let mut bench = iter::Benchmark::<4>::new(count);
|
||||
b.iter(move || bench.run());
|
||||
});
|
||||
}
|
||||
for count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("size_512_events_{}", count), |b| {
|
||||
group.bench_function(format!("size_512_events_{count}"), |b| {
|
||||
let mut bench = iter::Benchmark::<512>::new(count);
|
||||
b.iter(move || bench.run());
|
||||
});
|
||||
|
@ -130,7 +130,7 @@ fn par_iter_simple(c: &mut Criterion) {
|
||||
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| {
|
||||
group.bench_function(format!("with_{f}_fragment"), |b| {
|
||||
let mut bench = par_iter_simple::Benchmark::new(f);
|
||||
b.iter(move || bench.run());
|
||||
});
|
||||
|
@ -24,7 +24,7 @@ pub fn run_condition_yes(criterion: &mut Criterion) {
|
||||
}
|
||||
// run once to initialize systems
|
||||
schedule.run(&mut world);
|
||||
group.bench_function(format!("{}_systems", amount), |bencher| {
|
||||
group.bench_function(format!("{amount}_systems"), |bencher| {
|
||||
bencher.iter(|| {
|
||||
schedule.run(&mut world);
|
||||
});
|
||||
@ -46,7 +46,7 @@ pub fn run_condition_no(criterion: &mut Criterion) {
|
||||
}
|
||||
// run once to initialize systems
|
||||
schedule.run(&mut world);
|
||||
group.bench_function(format!("{}_systems", amount), |bencher| {
|
||||
group.bench_function(format!("{amount}_systems"), |bencher| {
|
||||
bencher.iter(|| {
|
||||
schedule.run(&mut world);
|
||||
});
|
||||
@ -77,7 +77,7 @@ pub fn run_condition_yes_with_query(criterion: &mut Criterion) {
|
||||
}
|
||||
// run once to initialize systems
|
||||
schedule.run(&mut world);
|
||||
group.bench_function(format!("{}_systems", amount), |bencher| {
|
||||
group.bench_function(format!("{amount}_systems"), |bencher| {
|
||||
bencher.iter(|| {
|
||||
schedule.run(&mut world);
|
||||
});
|
||||
@ -105,7 +105,7 @@ pub fn run_condition_yes_with_resource(criterion: &mut Criterion) {
|
||||
}
|
||||
// run once to initialize systems
|
||||
schedule.run(&mut world);
|
||||
group.bench_function(format!("{}_systems", amount), |bencher| {
|
||||
group.bench_function(format!("{amount}_systems"), |bencher| {
|
||||
bencher.iter(|| {
|
||||
schedule.run(&mut world);
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ pub fn empty_systems(criterion: &mut Criterion) {
|
||||
schedule.add_systems(empty);
|
||||
}
|
||||
schedule.run(&mut world);
|
||||
group.bench_function(format!("{}_systems", amount), |bencher| {
|
||||
group.bench_function(format!("{amount}_systems"), |bencher| {
|
||||
bencher.iter(|| {
|
||||
schedule.run(&mut world);
|
||||
});
|
||||
@ -38,7 +38,7 @@ pub fn empty_systems(criterion: &mut Criterion) {
|
||||
schedule.add_systems((empty, empty, empty, empty, empty));
|
||||
}
|
||||
schedule.run(&mut world);
|
||||
group.bench_function(format!("{}_systems", amount), |bencher| {
|
||||
group.bench_function(format!("{amount}_systems"), |bencher| {
|
||||
bencher.iter(|| {
|
||||
schedule.run(&mut world);
|
||||
});
|
||||
@ -79,10 +79,7 @@ pub fn busy_systems(criterion: &mut Criterion) {
|
||||
}
|
||||
schedule.run(&mut world);
|
||||
group.bench_function(
|
||||
format!(
|
||||
"{:02}x_entities_{:02}_systems",
|
||||
entity_bunches, system_amount
|
||||
),
|
||||
format!("{entity_bunches:02}x_entities_{system_amount:02}_systems"),
|
||||
|bencher| {
|
||||
bencher.iter(|| {
|
||||
schedule.run(&mut world);
|
||||
@ -128,10 +125,7 @@ pub fn contrived(criterion: &mut Criterion) {
|
||||
}
|
||||
schedule.run(&mut world);
|
||||
group.bench_function(
|
||||
format!(
|
||||
"{:02}x_entities_{:02}_systems",
|
||||
entity_bunches, system_amount
|
||||
),
|
||||
format!("{entity_bunches:02}x_entities_{system_amount:02}_systems"),
|
||||
|bencher| {
|
||||
bencher.iter(|| {
|
||||
schedule.run(&mut world);
|
||||
|
@ -37,7 +37,7 @@ pub fn spawn_commands(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("{}_entities", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities"), |bencher| {
|
||||
let mut world = World::default();
|
||||
let mut command_queue = CommandQueue::default();
|
||||
|
||||
@ -68,7 +68,7 @@ pub fn nonempty_spawn_commands(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("{}_entities", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities"), |bencher| {
|
||||
let mut world = World::default();
|
||||
let mut command_queue = CommandQueue::default();
|
||||
|
||||
@ -162,7 +162,7 @@ pub fn fake_commands(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for command_count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("{}_commands", command_count), |bencher| {
|
||||
group.bench_function(format!("{command_count}_commands"), |bencher| {
|
||||
let mut world = World::default();
|
||||
let mut command_queue = CommandQueue::default();
|
||||
|
||||
@ -207,7 +207,7 @@ pub fn sized_commands_impl<T: Default + Command>(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for command_count in [100, 1_000, 10_000] {
|
||||
group.bench_function(format!("{}_commands", command_count), |bencher| {
|
||||
group.bench_function(format!("{command_count}_commands"), |bencher| {
|
||||
let mut world = World::default();
|
||||
let mut command_queue = CommandQueue::default();
|
||||
|
||||
|
@ -13,7 +13,7 @@ pub fn world_despawn(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in [1, 100, 10_000] {
|
||||
group.bench_function(format!("{}_entities", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities"), |bencher| {
|
||||
bencher.iter_batched_ref(
|
||||
|| {
|
||||
let mut world = World::default();
|
||||
|
@ -13,7 +13,7 @@ pub fn world_despawn_recursive(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in [1, 100, 10_000] {
|
||||
group.bench_function(format!("{}_entities", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities"), |bencher| {
|
||||
bencher.iter_batched_ref(
|
||||
|| {
|
||||
let mut world = World::default();
|
||||
|
@ -13,7 +13,7 @@ pub fn world_spawn(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in [1, 100, 10_000] {
|
||||
group.bench_function(format!("{}_entities", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities"), |bencher| {
|
||||
let mut world = World::default();
|
||||
bencher.iter(|| {
|
||||
for _ in 0..entity_count {
|
||||
|
@ -49,7 +49,7 @@ pub fn world_entity(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in RANGE.map(|i| i * 10_000) {
|
||||
group.bench_function(format!("{}_entities", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities"), |bencher| {
|
||||
let world = setup::<Table>(entity_count);
|
||||
|
||||
bencher.iter(|| {
|
||||
@ -72,7 +72,7 @@ pub fn world_get(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in RANGE.map(|i| i * 10_000) {
|
||||
group.bench_function(format!("{}_entities_table", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_table"), |bencher| {
|
||||
let world = setup::<Table>(entity_count);
|
||||
|
||||
bencher.iter(|| {
|
||||
@ -84,7 +84,7 @@ pub fn world_get(criterion: &mut Criterion) {
|
||||
}
|
||||
});
|
||||
});
|
||||
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_sparse"), |bencher| {
|
||||
let world = setup::<Sparse>(entity_count);
|
||||
|
||||
bencher.iter(|| {
|
||||
@ -107,7 +107,7 @@ pub fn world_query_get(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in RANGE.map(|i| i * 10_000) {
|
||||
group.bench_function(format!("{}_entities_table", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_table"), |bencher| {
|
||||
let mut world = setup::<Table>(entity_count);
|
||||
let mut query = world.query::<&Table>();
|
||||
|
||||
@ -120,7 +120,7 @@ pub fn world_query_get(criterion: &mut Criterion) {
|
||||
}
|
||||
});
|
||||
});
|
||||
group.bench_function(format!("{}_entities_table_wide", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_table_wide"), |bencher| {
|
||||
let mut world = setup_wide::<(
|
||||
WideTable<0>,
|
||||
WideTable<1>,
|
||||
@ -147,7 +147,7 @@ pub fn world_query_get(criterion: &mut Criterion) {
|
||||
}
|
||||
});
|
||||
});
|
||||
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_sparse"), |bencher| {
|
||||
let mut world = setup::<Sparse>(entity_count);
|
||||
let mut query = world.query::<&Sparse>();
|
||||
|
||||
@ -160,37 +160,33 @@ pub fn world_query_get(criterion: &mut Criterion) {
|
||||
}
|
||||
});
|
||||
});
|
||||
group.bench_function(
|
||||
format!("{}_entities_sparse_wide", entity_count),
|
||||
|bencher| {
|
||||
let mut world = setup_wide::<(
|
||||
WideSparse<0>,
|
||||
WideSparse<1>,
|
||||
WideSparse<2>,
|
||||
WideSparse<3>,
|
||||
WideSparse<4>,
|
||||
WideSparse<5>,
|
||||
)>(entity_count);
|
||||
let mut query = world.query::<(
|
||||
&WideSparse<0>,
|
||||
&WideSparse<1>,
|
||||
&WideSparse<2>,
|
||||
&WideSparse<3>,
|
||||
&WideSparse<4>,
|
||||
&WideSparse<5>,
|
||||
)>();
|
||||
group.bench_function(format!("{entity_count}_entities_sparse_wide"), |bencher| {
|
||||
let mut world = setup_wide::<(
|
||||
WideSparse<0>,
|
||||
WideSparse<1>,
|
||||
WideSparse<2>,
|
||||
WideSparse<3>,
|
||||
WideSparse<4>,
|
||||
WideSparse<5>,
|
||||
)>(entity_count);
|
||||
let mut query = world.query::<(
|
||||
&WideSparse<0>,
|
||||
&WideSparse<1>,
|
||||
&WideSparse<2>,
|
||||
&WideSparse<3>,
|
||||
&WideSparse<4>,
|
||||
&WideSparse<5>,
|
||||
)>();
|
||||
|
||||
bencher.iter(|| {
|
||||
for i in 0..entity_count {
|
||||
// SAFETY: Range is exclusive.
|
||||
let entity = Entity::from_raw(EntityRow::new(unsafe {
|
||||
NonMaxU32::new_unchecked(i)
|
||||
}));
|
||||
assert!(query.get(&world, entity).is_ok());
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
bencher.iter(|| {
|
||||
for i in 0..entity_count {
|
||||
// SAFETY: Range is exclusive.
|
||||
let entity =
|
||||
Entity::from_raw(EntityRow::new(unsafe { NonMaxU32::new_unchecked(i) }));
|
||||
assert!(query.get(&world, entity).is_ok());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
group.finish();
|
||||
@ -202,7 +198,7 @@ pub fn world_query_iter(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in RANGE.map(|i| i * 10_000) {
|
||||
group.bench_function(format!("{}_entities_table", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_table"), |bencher| {
|
||||
let mut world = setup::<Table>(entity_count);
|
||||
let mut query = world.query::<&Table>();
|
||||
|
||||
@ -216,7 +212,7 @@ pub fn world_query_iter(criterion: &mut Criterion) {
|
||||
assert_eq!(black_box(count), entity_count);
|
||||
});
|
||||
});
|
||||
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_sparse"), |bencher| {
|
||||
let mut world = setup::<Sparse>(entity_count);
|
||||
let mut query = world.query::<&Sparse>();
|
||||
|
||||
@ -241,7 +237,7 @@ pub fn world_query_for_each(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in RANGE.map(|i| i * 10_000) {
|
||||
group.bench_function(format!("{}_entities_table", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_table"), |bencher| {
|
||||
let mut world = setup::<Table>(entity_count);
|
||||
let mut query = world.query::<&Table>();
|
||||
|
||||
@ -255,7 +251,7 @@ pub fn world_query_for_each(criterion: &mut Criterion) {
|
||||
assert_eq!(black_box(count), entity_count);
|
||||
});
|
||||
});
|
||||
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_sparse"), |bencher| {
|
||||
let mut world = setup::<Sparse>(entity_count);
|
||||
let mut query = world.query::<&Sparse>();
|
||||
|
||||
@ -280,7 +276,7 @@ pub fn query_get(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(4));
|
||||
|
||||
for entity_count in RANGE.map(|i| i * 10_000) {
|
||||
group.bench_function(format!("{}_entities_table", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_table"), |bencher| {
|
||||
let mut world = World::default();
|
||||
let mut entities: Vec<_> = world
|
||||
.spawn_batch((0..entity_count).map(|_| Table::default()))
|
||||
@ -299,7 +295,7 @@ pub fn query_get(criterion: &mut Criterion) {
|
||||
assert_eq!(black_box(count), entity_count);
|
||||
});
|
||||
});
|
||||
group.bench_function(format!("{}_entities_sparse", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_entities_sparse"), |bencher| {
|
||||
let mut world = World::default();
|
||||
let mut entities: Vec<_> = world
|
||||
.spawn_batch((0..entity_count).map(|_| Sparse::default()))
|
||||
@ -329,7 +325,7 @@ pub fn query_get_many<const N: usize>(criterion: &mut Criterion) {
|
||||
group.measurement_time(core::time::Duration::from_secs(2 * N as u64));
|
||||
|
||||
for entity_count in RANGE.map(|i| i * 10_000) {
|
||||
group.bench_function(format!("{}_calls_table", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_calls_table"), |bencher| {
|
||||
let mut world = World::default();
|
||||
let mut entity_groups: Vec<_> = (0..entity_count)
|
||||
.map(|_| [(); N].map(|_| world.spawn(Table::default()).id()))
|
||||
@ -352,7 +348,7 @@ pub fn query_get_many<const N: usize>(criterion: &mut Criterion) {
|
||||
assert_eq!(black_box(count), entity_count);
|
||||
});
|
||||
});
|
||||
group.bench_function(format!("{}_calls_sparse", entity_count), |bencher| {
|
||||
group.bench_function(format!("{entity_count}_calls_sparse"), |bencher| {
|
||||
let mut world = World::default();
|
||||
let mut entity_groups: Vec<_> = (0..entity_count)
|
||||
.map(|_| [(); N].map(|_| world.spawn(Sparse::default()).id()))
|
||||
|
@ -142,7 +142,7 @@ fn concrete_map_apply(criterion: &mut Criterion) {
|
||||
|
||||
fn u64_to_n_byte_key(k: u64, n: usize) -> String {
|
||||
let mut key = String::with_capacity(n);
|
||||
write!(&mut key, "{}", k).unwrap();
|
||||
write!(&mut key, "{k}").unwrap();
|
||||
|
||||
// Pad key to n bytes.
|
||||
key.extend(iter::repeat_n('\0', n - key.len()));
|
||||
|
@ -55,7 +55,7 @@ fn concrete_struct_field(criterion: &mut Criterion) {
|
||||
&s,
|
||||
|bencher, s| {
|
||||
let field_names = (0..field_count)
|
||||
.map(|i| format!("field_{}", i))
|
||||
.map(|i| format!("field_{i}"))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
bencher.iter(|| {
|
||||
@ -256,7 +256,7 @@ fn dynamic_struct_apply(criterion: &mut Criterion) {
|
||||
|
||||
let mut base = DynamicStruct::default();
|
||||
for i in 0..field_count {
|
||||
let field_name = format!("field_{}", i);
|
||||
let field_name = format!("field_{i}");
|
||||
base.insert(&field_name, 1u32);
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ fn dynamic_struct_apply(criterion: &mut Criterion) {
|
||||
let mut base = DynamicStruct::default();
|
||||
let mut patch = DynamicStruct::default();
|
||||
for i in 0..field_count {
|
||||
let field_name = format!("field_{}", i);
|
||||
let field_name = format!("field_{i}");
|
||||
base.insert(&field_name, 0u32);
|
||||
patch.insert(&field_name, 1u32);
|
||||
}
|
||||
@ -309,11 +309,11 @@ fn dynamic_struct_insert(criterion: &mut Criterion) {
|
||||
|bencher, field_count| {
|
||||
let mut s = DynamicStruct::default();
|
||||
for i in 0..*field_count {
|
||||
let field_name = format!("field_{}", i);
|
||||
let field_name = format!("field_{i}");
|
||||
s.insert(&field_name, ());
|
||||
}
|
||||
|
||||
let field = format!("field_{}", field_count);
|
||||
let field = format!("field_{field_count}");
|
||||
bencher.iter_batched(
|
||||
|| s.to_dynamic_struct(),
|
||||
|mut s| {
|
||||
@ -339,7 +339,7 @@ fn dynamic_struct_get_field(criterion: &mut Criterion) {
|
||||
|bencher, field_count| {
|
||||
let mut s = DynamicStruct::default();
|
||||
for i in 0..*field_count {
|
||||
let field_name = format!("field_{}", i);
|
||||
let field_name = format!("field_{i}");
|
||||
s.insert(&field_name, ());
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ impl TaskPoolOptions {
|
||||
pub fn create_default_pools(&self) {
|
||||
let total_threads = bevy_tasks::available_parallelism()
|
||||
.clamp(self.min_total_threads, self.max_total_threads);
|
||||
trace!("Assigning {} cores to default task pools", total_threads);
|
||||
trace!("Assigning {total_threads} cores to default task pools");
|
||||
|
||||
let mut remaining_threads = total_threads;
|
||||
|
||||
@ -170,7 +170,7 @@ impl TaskPoolOptions {
|
||||
.io
|
||||
.get_number_of_threads(remaining_threads, total_threads);
|
||||
|
||||
trace!("IO Threads: {}", io_threads);
|
||||
trace!("IO Threads: {io_threads}");
|
||||
remaining_threads = remaining_threads.saturating_sub(io_threads);
|
||||
|
||||
IoTaskPool::get_or_init(|| {
|
||||
@ -200,7 +200,7 @@ impl TaskPoolOptions {
|
||||
.async_compute
|
||||
.get_number_of_threads(remaining_threads, total_threads);
|
||||
|
||||
trace!("Async Compute Threads: {}", async_compute_threads);
|
||||
trace!("Async Compute Threads: {async_compute_threads}");
|
||||
remaining_threads = remaining_threads.saturating_sub(async_compute_threads);
|
||||
|
||||
AsyncComputeTaskPool::get_or_init(|| {
|
||||
@ -231,7 +231,7 @@ impl TaskPoolOptions {
|
||||
.compute
|
||||
.get_number_of_threads(remaining_threads, total_threads);
|
||||
|
||||
trace!("Compute Threads: {}", compute_threads);
|
||||
trace!("Compute Threads: {compute_threads}");
|
||||
|
||||
ComputeTaskPool::get_or_init(|| {
|
||||
let builder = TaskPoolBuilder::default()
|
||||
|
@ -1931,7 +1931,7 @@ pub enum AssetLoadError {
|
||||
base_path,
|
||||
label,
|
||||
all_labels.len(),
|
||||
all_labels.iter().map(|l| format!("'{}'", l)).collect::<Vec<_>>().join(", "))]
|
||||
all_labels.iter().map(|l| format!("'{l}'")).collect::<Vec<_>>().join(", "))]
|
||||
MissingLabel {
|
||||
base_path: AssetPath<'static>,
|
||||
label: String,
|
||||
|
@ -344,17 +344,11 @@ mod tests {
|
||||
|
||||
assert!(
|
||||
db_delta.abs() < 1e-2,
|
||||
"Expected ~{}dB, got {}dB (delta {})",
|
||||
db,
|
||||
db_test,
|
||||
db_delta
|
||||
"Expected ~{db}dB, got {db_test}dB (delta {db_delta})",
|
||||
);
|
||||
assert!(
|
||||
linear_relative_delta.abs() < 1e-3,
|
||||
"Expected ~{}, got {} (relative delta {})",
|
||||
linear,
|
||||
linear_test,
|
||||
linear_relative_delta
|
||||
"Expected ~{linear}, got {linear_test} (relative delta {linear_relative_delta})",
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -474,15 +468,11 @@ mod tests {
|
||||
match (a, b) {
|
||||
(Decibels(a), Decibels(b)) | (Linear(a), Linear(b)) => assert!(
|
||||
(a - b).abs() < EPSILON,
|
||||
"Expected {:?} to be approximately equal to {:?}",
|
||||
a,
|
||||
b
|
||||
"Expected {a:?} to be approximately equal to {b:?}",
|
||||
),
|
||||
(a, b) => assert!(
|
||||
(a.to_decibels() - b.to_decibels()).abs() < EPSILON,
|
||||
"Expected {:?} to be approximately equal to {:?}",
|
||||
a,
|
||||
b
|
||||
"Expected {a:?} to be approximately equal to {b:?}",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ pub(crate) fn send_events(world: &mut World, mut current_frame: Local<u32>) {
|
||||
world.spawn(Screenshot::primary_window()).observe(
|
||||
move |captured: On<bevy_render::view::screenshot::ScreenshotCaptured>,
|
||||
mut exit_event: EventWriter<AppExit>| {
|
||||
let path = format!("./screenshot-{}.png", this_frame);
|
||||
let path = format!("./screenshot-{this_frame}.png");
|
||||
save_to_disk(path)(captured);
|
||||
info!("Exiting. Test successful!");
|
||||
exit_event.write(AppExit::Success);
|
||||
@ -42,7 +42,7 @@ pub(crate) fn send_events(world: &mut World, mut current_frame: Local<u32>) {
|
||||
info!("Took a screenshot at frame {}.", *current_frame);
|
||||
}
|
||||
CiTestingEvent::NamedScreenshot(name) => {
|
||||
let path = format!("./screenshot-{}.png", name);
|
||||
let path = format!("./screenshot-{name}.png");
|
||||
world
|
||||
.spawn(Screenshot::primary_window())
|
||||
.observe(save_to_disk(path));
|
||||
|
@ -202,7 +202,7 @@ impl LogDiagnosticsPlugin {
|
||||
) {
|
||||
if state.timer.tick(time.delta()).is_finished() {
|
||||
Self::for_each_diagnostic(&state, &diagnostics, |diagnostic| {
|
||||
debug!("{:#?}\n", diagnostic);
|
||||
debug!("{diagnostic:#?}\n");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -353,6 +353,10 @@ impl<'scope, 'env: 'scope, 'sys> Context<'scope, 'env, 'sys> {
|
||||
self.tick_executor();
|
||||
}
|
||||
|
||||
#[expect(
|
||||
clippy::mut_from_ref,
|
||||
reason = "Field is only accessed here and is guarded by lock with a documented safety comment"
|
||||
)]
|
||||
fn try_lock<'a>(&'a self) -> Option<(&'a mut Conditions<'sys>, MutexGuard<'a, ExecutorState>)> {
|
||||
let guard = self.environment.executor.state.try_lock().ok()?;
|
||||
// SAFETY: This is an exclusive access as no other location fetches conditions mutably, and
|
||||
|
@ -1885,7 +1885,6 @@ mod tests {
|
||||
schedule.add_systems(sys);
|
||||
schedule.add_systems(|_query: Query<&Name>| {});
|
||||
schedule.add_systems(|_query: Query<&Name>| todo!());
|
||||
#[expect(clippy::unused_unit, reason = "this forces the () return type")]
|
||||
schedule.add_systems(|_query: Query<&Name>| -> () { todo!() });
|
||||
|
||||
fn obs(_trigger: On<Add, Name>) {
|
||||
@ -1895,7 +1894,6 @@ mod tests {
|
||||
world.add_observer(obs);
|
||||
world.add_observer(|_trigger: On<Add, Name>| {});
|
||||
world.add_observer(|_trigger: On<Add, Name>| todo!());
|
||||
#[expect(clippy::unused_unit, reason = "this forces the () return type")]
|
||||
world.add_observer(|_trigger: On<Add, Name>| -> () { todo!() });
|
||||
|
||||
fn my_command(_world: &mut World) {
|
||||
@ -1905,7 +1903,6 @@ mod tests {
|
||||
world.commands().queue(my_command);
|
||||
world.commands().queue(|_world: &mut World| {});
|
||||
world.commands().queue(|_world: &mut World| todo!());
|
||||
#[expect(clippy::unused_unit, reason = "this forces the () return type")]
|
||||
world
|
||||
.commands()
|
||||
.queue(|_world: &mut World| -> () { todo!() });
|
||||
|
@ -11,7 +11,7 @@ pub(crate) fn primitive_name(mesh: &Mesh<'_>, material: &Material) -> String {
|
||||
let mesh_name = mesh.name().unwrap_or("Mesh");
|
||||
|
||||
if let Some(material_name) = material.name() {
|
||||
format!("{}.{}", mesh_name, material_name)
|
||||
format!("{mesh_name}.{material_name}")
|
||||
} else {
|
||||
mesh_name.to_string()
|
||||
}
|
||||
|
@ -818,8 +818,7 @@ impl Image {
|
||||
);
|
||||
debug_assert!(
|
||||
pixel.len() <= byte_len,
|
||||
"Fill data must fit within pixel buffer (expected {}B).",
|
||||
byte_len,
|
||||
"Fill data must fit within pixel buffer (expected {byte_len}B).",
|
||||
);
|
||||
let data = pixel.iter().copied().cycle().take(byte_len).collect();
|
||||
Image::new(size, dimension, data, format, asset_usage)
|
||||
|
@ -1516,7 +1516,7 @@ pub fn gamepad_connection_system(
|
||||
product_id,
|
||||
} => {
|
||||
let Ok(mut gamepad) = commands.get_entity(id) else {
|
||||
warn!("Gamepad {} removed before handling connection event.", id);
|
||||
warn!("Gamepad {id} removed before handling connection event.");
|
||||
continue;
|
||||
};
|
||||
gamepad.insert((
|
||||
@ -1527,18 +1527,18 @@ pub fn gamepad_connection_system(
|
||||
..Default::default()
|
||||
},
|
||||
));
|
||||
info!("Gamepad {} connected.", id);
|
||||
info!("Gamepad {id} connected.");
|
||||
}
|
||||
GamepadConnection::Disconnected => {
|
||||
let Ok(mut gamepad) = commands.get_entity(id) else {
|
||||
warn!("Gamepad {} removed before handling disconnection event. You can ignore this if you manually removed it.", id);
|
||||
warn!("Gamepad {id} removed before handling disconnection event. You can ignore this if you manually removed it.");
|
||||
continue;
|
||||
};
|
||||
// Gamepad entities are left alive to preserve their state (e.g. [`GamepadSettings`]).
|
||||
// Instead of despawning, we remove Gamepad components that don't need to preserve state
|
||||
// and re-add them if they ever reconnect.
|
||||
gamepad.remove::<Gamepad>();
|
||||
info!("Gamepad {} disconnected.", id);
|
||||
info!("Gamepad {id} disconnected.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ pub fn handle_tab_navigation(
|
||||
visible.0 = true;
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Tab navigation error: {}", e);
|
||||
warn!("Tab navigation error: {e}");
|
||||
// This failure mode is recoverable, but still indicates a problem.
|
||||
if let TabNavigationError::NoTabGroupForCurrentFocus { new_focus, .. } = e {
|
||||
trigger.propagate(false);
|
||||
|
@ -314,7 +314,7 @@ impl Plugin for LogPlugin {
|
||||
.and_then(|source| source.downcast_ref::<ParseError>())
|
||||
.map(|parse_err| {
|
||||
// we cannot use the `error!` macro here because the logger is not ready yet.
|
||||
eprintln!("LogPlugin failed to parse filter from env: {}", parse_err);
|
||||
eprintln!("LogPlugin failed to parse filter from env: {parse_err}");
|
||||
});
|
||||
|
||||
Ok::<EnvFilter, FromEnvError>(EnvFilter::builder().parse_lossy(&default_filter))
|
||||
|
@ -1096,6 +1096,10 @@ mod tests {
|
||||
});
|
||||
}
|
||||
|
||||
#[expect(
|
||||
clippy::neg_multiply,
|
||||
reason = "Clippy doesn't like this, but it's correct"
|
||||
)]
|
||||
#[test]
|
||||
fn mapping() {
|
||||
let curve = FunctionCurve::new(Interval::EVERYWHERE, |t| t * 3.0 + 1.0);
|
||||
|
@ -132,7 +132,7 @@ impl MaterialExtension for ForwardDecalMaterialExt {
|
||||
}
|
||||
|
||||
if let Some(label) = &mut descriptor.label {
|
||||
*label = format!("forward_decal_{}", label).into();
|
||||
*label = format!("forward_decal_{label}").into();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -93,24 +93,36 @@ impl MeshPipelineViewLayoutKey {
|
||||
|
||||
format!(
|
||||
"mesh_view_layout{}{}{}{}{}{}",
|
||||
self.contains(Key::MULTISAMPLED)
|
||||
.then_some("_multisampled")
|
||||
.unwrap_or_default(),
|
||||
self.contains(Key::DEPTH_PREPASS)
|
||||
.then_some("_depth")
|
||||
.unwrap_or_default(),
|
||||
self.contains(Key::NORMAL_PREPASS)
|
||||
.then_some("_normal")
|
||||
.unwrap_or_default(),
|
||||
self.contains(Key::MOTION_VECTOR_PREPASS)
|
||||
.then_some("_motion")
|
||||
.unwrap_or_default(),
|
||||
self.contains(Key::DEFERRED_PREPASS)
|
||||
.then_some("_deferred")
|
||||
.unwrap_or_default(),
|
||||
self.contains(Key::OIT_ENABLED)
|
||||
.then_some("_oit")
|
||||
.unwrap_or_default(),
|
||||
if self.contains(Key::MULTISAMPLED) {
|
||||
"_multisampled"
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
if self.contains(Key::DEPTH_PREPASS) {
|
||||
"_depth"
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
if self.contains(Key::NORMAL_PREPASS) {
|
||||
"_normal"
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
if self.contains(Key::MOTION_VECTOR_PREPASS) {
|
||||
"_motion"
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
if self.contains(Key::DEFERRED_PREPASS) {
|
||||
"_deferred"
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
if self.contains(Key::OIT_ENABLED) {
|
||||
"_oit"
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ pub fn process_remote_get_resource_request(
|
||||
else {
|
||||
return Err(BrpError {
|
||||
code: error_codes::RESOURCE_ERROR,
|
||||
message: format!("Resource `{}` could not be serialized", resource_path),
|
||||
message: format!("Resource `{resource_path}` could not be serialized"),
|
||||
data: None,
|
||||
});
|
||||
};
|
||||
@ -699,7 +699,7 @@ fn reflect_component(
|
||||
else {
|
||||
return Err(BrpError {
|
||||
code: error_codes::COMPONENT_ERROR,
|
||||
message: format!("Component `{}` could not be serialized", component_path),
|
||||
message: format!("Component `{component_path}` could not be serialized"),
|
||||
data: None,
|
||||
});
|
||||
};
|
||||
|
@ -192,7 +192,7 @@ impl Msaa {
|
||||
2 => Msaa::Sample2,
|
||||
4 => Msaa::Sample4,
|
||||
8 => Msaa::Sample8,
|
||||
_ => panic!("Unsupported MSAA sample count: {}", samples),
|
||||
_ => panic!("Unsupported MSAA sample count: {samples}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ mod tests {
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
serializer.serialize_str(&format!("{:X}", value))
|
||||
serializer.serialize_str(&format!("{value:X}"))
|
||||
}
|
||||
|
||||
pub fn deserialize<'de, D>(deserializer: D) -> Result<u32, D::Error>
|
||||
|
@ -116,7 +116,7 @@ impl AppExtStates for SubApp {
|
||||
}
|
||||
} else {
|
||||
let name = core::any::type_name::<S>();
|
||||
warn!("State {} is already initialized.", name);
|
||||
warn!("State {name} is already initialized.");
|
||||
}
|
||||
|
||||
self
|
||||
@ -178,7 +178,7 @@ impl AppExtStates for SubApp {
|
||||
}
|
||||
} else {
|
||||
let name = core::any::type_name::<S>();
|
||||
warn!("Computed state {} is already initialized.", name);
|
||||
warn!("Computed state {name} is already initialized.");
|
||||
}
|
||||
|
||||
self
|
||||
@ -209,7 +209,7 @@ impl AppExtStates for SubApp {
|
||||
}
|
||||
} else {
|
||||
let name = core::any::type_name::<S>();
|
||||
warn!("Sub state {} is already initialized.", name);
|
||||
warn!("Sub state {name} is already initialized.");
|
||||
}
|
||||
|
||||
self
|
||||
@ -222,7 +222,7 @@ impl AppExtStates for SubApp {
|
||||
.contains_resource::<Events<StateTransitionEvent<S>>>()
|
||||
{
|
||||
let name = core::any::type_name::<S>();
|
||||
warn!("State scoped entities are enabled for state `{}`, but the state isn't installed in the app!", name);
|
||||
warn!("State scoped entities are enabled for state `{name}`, but the state isn't installed in the app!");
|
||||
}
|
||||
|
||||
// Note: We work with `StateTransition` in set
|
||||
|
@ -21,7 +21,7 @@ impl CommandsStatesExt for Commands<'_, '_> {
|
||||
let mut next = w.resource_mut::<NextState<S>>();
|
||||
if let NextState::Pending(prev) = &*next {
|
||||
if *prev != state {
|
||||
debug!("overwriting next state {:?} with {:?}", prev, state);
|
||||
debug!("overwriting next state {prev:?} with {state:?}");
|
||||
}
|
||||
}
|
||||
next.set(state);
|
||||
|
@ -703,15 +703,13 @@ impl WindowResizeConstraints {
|
||||
min_height = min_height.max(1.);
|
||||
if max_width < min_width {
|
||||
warn!(
|
||||
"The given maximum width {} is smaller than the minimum width {}",
|
||||
max_width, min_width
|
||||
"The given maximum width {max_width} is smaller than the minimum width {min_width}"
|
||||
);
|
||||
max_width = min_width;
|
||||
}
|
||||
if max_height < min_height {
|
||||
warn!(
|
||||
"The given maximum height {} is smaller than the minimum height {}",
|
||||
max_height, min_height
|
||||
"The given maximum height {max_height} is smaller than the minimum height {min_height}",
|
||||
);
|
||||
max_height = min_height;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ pub(crate) fn changed_windows(
|
||||
&monitor_selection,
|
||||
)
|
||||
.unwrap_or_else(|| {
|
||||
panic!("Could not find monitor for {:?}", monitor_selection)
|
||||
panic!("Could not find monitor for {monitor_selection:?}")
|
||||
});
|
||||
|
||||
if let Some(video_mode) = get_selected_videomode(monitor, &video_mode_selection)
|
||||
|
@ -529,7 +529,7 @@ impl core::fmt::Display for DisplayInfo {
|
||||
let millihertz = self.refresh_rate_millihertz.unwrap_or(0);
|
||||
let hertz = millihertz / 1000;
|
||||
let extra_millihertz = millihertz % 1000;
|
||||
write!(f, " Refresh rate (Hz): {}.{:03}", hertz, extra_millihertz)?;
|
||||
write!(f, " Refresh rate (Hz): {hertz}.{extra_millihertz:03}")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ fn update_bloom_settings(
|
||||
}
|
||||
}
|
||||
|
||||
text.push_str(&format!("(O) Tonemapping: {:?}\n", tonemapping));
|
||||
text.push_str(&format!("(O) Tonemapping: {tonemapping:?}\n"));
|
||||
if keycode.just_pressed(KeyCode::KeyO) {
|
||||
commands
|
||||
.entity(camera_entity)
|
||||
|
@ -353,11 +353,7 @@ impl AppStatus {
|
||||
let mesh_help_text = format!("Press Q to change to {}", self.visible_scene.next());
|
||||
|
||||
// Build the `Text` object.
|
||||
format!(
|
||||
"{}\n{}\n{}",
|
||||
material_variant_help_text, light_help_text, mesh_help_text,
|
||||
)
|
||||
.into()
|
||||
format!("{material_variant_help_text}\n{light_help_text}\n{mesh_help_text}",).into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ fn toggle_ambient_light(
|
||||
0. => "off",
|
||||
_ => "on",
|
||||
};
|
||||
*writer.text(entity, 1) = format!("Ambient light is {}\n", ambient_light_state_text);
|
||||
*writer.text(entity, 1) = format!("Ambient light is {ambient_light_state_text}\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -587,8 +587,7 @@ fn update_status_text(
|
||||
|
||||
let _ = write!(
|
||||
&mut text.0,
|
||||
"{}/{} meshes rendered",
|
||||
rendered_object_count, total_mesh_count
|
||||
"{rendered_object_count}/{total_mesh_count} meshes rendered"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -175,8 +175,7 @@ fn update(
|
||||
|
||||
if let Some(thickness) = ssao.map(|s| s.constant_object_thickness) {
|
||||
text.push_str(&format!(
|
||||
"Constant object thickness: {} (Up/Down)\n\n",
|
||||
thickness
|
||||
"Constant object thickness: {thickness} (Up/Down)\n\n"
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ fn add_mask_group_control(
|
||||
},
|
||||
))
|
||||
.with_child((
|
||||
Text(format!("{:?}", label)),
|
||||
Text(format!("{label:?}")),
|
||||
if index > 0 {
|
||||
button_text_style.clone()
|
||||
} else {
|
||||
|
@ -107,7 +107,7 @@ fn setup(mut commands: Commands) {
|
||||
|
||||
// Label
|
||||
p.spawn((
|
||||
Text2d(format!("{:?}", function)),
|
||||
Text2d(format!("{function:?}")),
|
||||
text_font.clone(),
|
||||
TextColor(color),
|
||||
Transform::from_xyz(0.0, -half_size.y - 15.0, 0.0),
|
||||
@ -140,7 +140,7 @@ fn display_curves(
|
||||
let now = ((time.elapsed_secs() % (duration + time_margin * 2.0) - time_margin) / duration)
|
||||
.clamp(0.0, 1.0);
|
||||
|
||||
ui_text.0 = format!("Progress: {:.2}", now);
|
||||
ui_text.0 = format!("Progress: {now:.2}");
|
||||
|
||||
for (EaseFunctionPlot(function, color), transform, children) in &ease_functions {
|
||||
let center = transform.translation.xy();
|
||||
|
@ -66,7 +66,7 @@ fn list_all_named_entities(
|
||||
// Query iteration order is not guaranteed, so we sort the names
|
||||
// to ensure the output is consistent.
|
||||
for name in query.iter().sort::<&Name>() {
|
||||
text_string.push_str(&format!("{:?}\n", name));
|
||||
text_string.push_str(&format!("{name:?}\n"));
|
||||
}
|
||||
|
||||
if let Ok(mut text) = name_text_query.single_mut() {
|
||||
|
@ -104,7 +104,7 @@ fn main() {
|
||||
));
|
||||
}
|
||||
|
||||
println!("{}", relationships);
|
||||
println!("{relationships}");
|
||||
}
|
||||
|
||||
world.run_system_once(debug_relationships).unwrap();
|
||||
|
@ -44,7 +44,7 @@ fn main() -> AnyhowResult<()> {
|
||||
|
||||
// Create the URL. We're going to need it to issue the HTTP request.
|
||||
let host_part = format!("{}:{}", args.host, args.port);
|
||||
let url = format!("http://{}/", host_part);
|
||||
let url = format!("http://{host_part}/");
|
||||
|
||||
let req = BrpRequest {
|
||||
jsonrpc: String::from("2.0"),
|
||||
@ -69,7 +69,7 @@ fn main() -> AnyhowResult<()> {
|
||||
.body_mut()
|
||||
.read_json::<serde_json::Value>()?;
|
||||
|
||||
println!("{:#}", res);
|
||||
println!("{res:#}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ fn infotext_system(mut commands: Commands) {
|
||||
fn panic_on_fail(scenes: Query<&DynamicSceneRoot>, asset_server: Res<AssetServer>) {
|
||||
for scene in &scenes {
|
||||
if let Some(LoadState::Failed(err)) = asset_server.get_load_state(&scene.0) {
|
||||
panic!("Failed to load scene. {}", err);
|
||||
panic!("Failed to load scene. {err}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ fn stress_test(num_entities: u32, num_components: u32, num_systems: u32) {
|
||||
// * u8 is Sync and Send
|
||||
unsafe {
|
||||
ComponentDescriptor::new_with_layout(
|
||||
format!("Component{}", i).to_string(),
|
||||
format!("Component{i}").to_string(),
|
||||
StorageType::Table,
|
||||
Layout::new::<u8>(),
|
||||
None,
|
||||
@ -180,10 +180,7 @@ fn main() {
|
||||
.nth(1)
|
||||
.and_then(|string| string.parse::<u32>().ok())
|
||||
.unwrap_or_else(|| {
|
||||
println!(
|
||||
"No valid number of entities provided, using default {}",
|
||||
DEFAULT_NUM_ENTITIES
|
||||
);
|
||||
println!("No valid number of entities provided, using default {DEFAULT_NUM_ENTITIES}");
|
||||
DEFAULT_NUM_ENTITIES
|
||||
});
|
||||
let num_components = std::env::args()
|
||||
@ -192,8 +189,7 @@ fn main() {
|
||||
.and_then(|n| if n >= 10 { Some(n) } else { None })
|
||||
.unwrap_or_else(|| {
|
||||
println!(
|
||||
"No valid number of components provided (>= 10), using default {}",
|
||||
DEFAULT_NUM_COMPONENTS
|
||||
"No valid number of components provided (>= 10), using default {DEFAULT_NUM_COMPONENTS}"
|
||||
);
|
||||
DEFAULT_NUM_COMPONENTS
|
||||
});
|
||||
@ -201,10 +197,7 @@ fn main() {
|
||||
.nth(3)
|
||||
.and_then(|string| string.parse::<u32>().ok())
|
||||
.unwrap_or_else(|| {
|
||||
println!(
|
||||
"No valid number of systems provided, using default {}",
|
||||
DEFAULT_NUM_SYSTEMS
|
||||
);
|
||||
println!("No valid number of systems provided, using default {DEFAULT_NUM_SYSTEMS}");
|
||||
DEFAULT_NUM_SYSTEMS
|
||||
});
|
||||
|
||||
|
@ -443,7 +443,7 @@ fn update_connected(
|
||||
|
||||
let formatted = gamepads
|
||||
.iter()
|
||||
.map(|(entity, name)| format!("{} - {}", entity, name))
|
||||
.map(|(entity, name)| format!("{entity} - {name}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
|
||||
|
@ -301,7 +301,7 @@ fn build_setting_row(
|
||||
let value_text = match setting_type {
|
||||
SettingType::Shape => SHAPES[value as usize % SHAPES.len()].0.to_string(),
|
||||
SettingType::Count => format!("{}", value as usize),
|
||||
_ => format!("{:.1}", value),
|
||||
_ => format!("{value:.1}"),
|
||||
};
|
||||
|
||||
(
|
||||
|
@ -158,7 +158,7 @@ fn setup_ui(
|
||||
let mut button_entities: HashMap<(u16, u16), Entity> = HashMap::default();
|
||||
for row in 0..N_ROWS {
|
||||
for col in 0..N_COLS {
|
||||
let button_name = format!("Button {}-{}", row, col);
|
||||
let button_name = format!("Button {row}-{col}");
|
||||
|
||||
let button_entity = commands
|
||||
.spawn((
|
||||
|
@ -252,7 +252,7 @@ fn setup(mut commands: Commands) {
|
||||
}
|
||||
}
|
||||
for mut label in label_query.iter_mut() {
|
||||
label.0 = format!("{:?}", current_space);
|
||||
label.0 = format!("{current_space:?}");
|
||||
}
|
||||
}
|
||||
).id();
|
||||
|
@ -131,7 +131,7 @@ fn setup(mut commands: Commands) {
|
||||
BackgroundColor(NORMAL_BUTTON),
|
||||
TabIndex(i),
|
||||
children![(
|
||||
Text::new(format!("TabIndex {}", i)),
|
||||
Text::new(format!("TabIndex {i}")),
|
||||
TextFont {
|
||||
font_size: 20.0,
|
||||
..default()
|
||||
|
@ -124,7 +124,7 @@ fn on_trigger_menu(trigger: On<OpenContextMenu>, mut commands: Commands) {
|
||||
|
||||
fn context_item(text: &str, col: Srgba) -> impl Bundle + use<> {
|
||||
(
|
||||
Name::new(format!("item-{}", text)),
|
||||
Name::new(format!("item-{text}")),
|
||||
ContextMenuItem(col),
|
||||
Button,
|
||||
Node {
|
||||
|
Loading…
Reference in New Issue
Block a user