diff --git a/benches/benches/bevy_ecs/events/mod.rs b/benches/benches/bevy_ecs/events/mod.rs index b87a138e06..c2c7f3ee28 100644 --- a/benches/benches/bevy_ecs/events/mod.rs +++ b/benches/benches/bevy_ecs/events/mod.rs @@ -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()); }); diff --git a/benches/benches/bevy_ecs/iteration/mod.rs b/benches/benches/bevy_ecs/iteration/mod.rs index 0fa7aced28..b296c5ce0b 100644 --- a/benches/benches/bevy_ecs/iteration/mod.rs +++ b/benches/benches/bevy_ecs/iteration/mod.rs @@ -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()); }); diff --git a/benches/benches/bevy_ecs/scheduling/run_condition.rs b/benches/benches/bevy_ecs/scheduling/run_condition.rs index 7b9cf418f4..9c40cf396e 100644 --- a/benches/benches/bevy_ecs/scheduling/run_condition.rs +++ b/benches/benches/bevy_ecs/scheduling/run_condition.rs @@ -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); }); diff --git a/benches/benches/bevy_ecs/scheduling/running_systems.rs b/benches/benches/bevy_ecs/scheduling/running_systems.rs index 2fc1da1710..159974117c 100644 --- a/benches/benches/bevy_ecs/scheduling/running_systems.rs +++ b/benches/benches/bevy_ecs/scheduling/running_systems.rs @@ -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); diff --git a/benches/benches/bevy_ecs/world/commands.rs b/benches/benches/bevy_ecs/world/commands.rs index bedfb8e5af..4836a243eb 100644 --- a/benches/benches/bevy_ecs/world/commands.rs +++ b/benches/benches/bevy_ecs/world/commands.rs @@ -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(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(); diff --git a/benches/benches/bevy_ecs/world/despawn.rs b/benches/benches/bevy_ecs/world/despawn.rs index cd693fc15c..7b79ed95d9 100644 --- a/benches/benches/bevy_ecs/world/despawn.rs +++ b/benches/benches/bevy_ecs/world/despawn.rs @@ -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(); diff --git a/benches/benches/bevy_ecs/world/despawn_recursive.rs b/benches/benches/bevy_ecs/world/despawn_recursive.rs index 78c644174b..f63c1a510b 100644 --- a/benches/benches/bevy_ecs/world/despawn_recursive.rs +++ b/benches/benches/bevy_ecs/world/despawn_recursive.rs @@ -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(); diff --git a/benches/benches/bevy_ecs/world/spawn.rs b/benches/benches/bevy_ecs/world/spawn.rs index 502d10ceb3..9cceda7ae5 100644 --- a/benches/benches/bevy_ecs/world/spawn.rs +++ b/benches/benches/bevy_ecs/world/spawn.rs @@ -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 { diff --git a/benches/benches/bevy_ecs/world/world_get.rs b/benches/benches/bevy_ecs/world/world_get.rs index e6e2a0bb90..81e0bf2b0f 100644 --- a/benches/benches/bevy_ecs/world/world_get.rs +++ b/benches/benches/bevy_ecs/world/world_get.rs @@ -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::(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::
(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::(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::
(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::(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::
(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::(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::
(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::(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(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(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())) diff --git a/benches/benches/bevy_reflect/map.rs b/benches/benches/bevy_reflect/map.rs index 1eab01a587..a70f89e12b 100644 --- a/benches/benches/bevy_reflect/map.rs +++ b/benches/benches/bevy_reflect/map.rs @@ -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())); diff --git a/benches/benches/bevy_reflect/struct.rs b/benches/benches/bevy_reflect/struct.rs index 7750213b6d..52d539f64d 100644 --- a/benches/benches/bevy_reflect/struct.rs +++ b/benches/benches/bevy_reflect/struct.rs @@ -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::>(); 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, ()); } diff --git a/crates/bevy_app/src/task_pool_plugin.rs b/crates/bevy_app/src/task_pool_plugin.rs index 5ed4e3fa5d..8014790f07 100644 --- a/crates/bevy_app/src/task_pool_plugin.rs +++ b/crates/bevy_app/src/task_pool_plugin.rs @@ -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() diff --git a/crates/bevy_asset/src/server/mod.rs b/crates/bevy_asset/src/server/mod.rs index e120888616..e5020dba75 100644 --- a/crates/bevy_asset/src/server/mod.rs +++ b/crates/bevy_asset/src/server/mod.rs @@ -1931,7 +1931,7 @@ pub enum AssetLoadError { base_path, label, all_labels.len(), - all_labels.iter().map(|l| format!("'{}'", l)).collect::>().join(", "))] + all_labels.iter().map(|l| format!("'{l}'")).collect::>().join(", "))] MissingLabel { base_path: AssetPath<'static>, label: String, diff --git a/crates/bevy_audio/src/volume.rs b/crates/bevy_audio/src/volume.rs index 1f1f417594..b8c0c776a5 100644 --- a/crates/bevy_audio/src/volume.rs +++ b/crates/bevy_audio/src/volume.rs @@ -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:?}", ), } } diff --git a/crates/bevy_dev_tools/src/ci_testing/systems.rs b/crates/bevy_dev_tools/src/ci_testing/systems.rs index 68a8615fea..ae7a2a774e 100644 --- a/crates/bevy_dev_tools/src/ci_testing/systems.rs +++ b/crates/bevy_dev_tools/src/ci_testing/systems.rs @@ -26,7 +26,7 @@ pub(crate) fn send_events(world: &mut World, mut current_frame: Local) { world.spawn(Screenshot::primary_window()).observe( move |captured: On, mut exit_event: EventWriter| { - 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) { 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)); diff --git a/crates/bevy_diagnostic/src/log_diagnostics_plugin.rs b/crates/bevy_diagnostic/src/log_diagnostics_plugin.rs index 4175eb395e..f6888ea723 100644 --- a/crates/bevy_diagnostic/src/log_diagnostics_plugin.rs +++ b/crates/bevy_diagnostic/src/log_diagnostics_plugin.rs @@ -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"); }); } } diff --git a/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs b/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs index b6036ee76b..7938a00e06 100644 --- a/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs +++ b/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs @@ -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 diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index 3e63dcf3d6..7a04e2fae0 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -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) { @@ -1895,7 +1894,6 @@ mod tests { world.add_observer(obs); world.add_observer(|_trigger: On| {}); world.add_observer(|_trigger: On| todo!()); - #[expect(clippy::unused_unit, reason = "this forces the () return type")] world.add_observer(|_trigger: On| -> () { 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!() }); diff --git a/crates/bevy_gltf/src/loader/gltf_ext/mesh.rs b/crates/bevy_gltf/src/loader/gltf_ext/mesh.rs index 60a153fed3..25d6677832 100644 --- a/crates/bevy_gltf/src/loader/gltf_ext/mesh.rs +++ b/crates/bevy_gltf/src/loader/gltf_ext/mesh.rs @@ -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() } diff --git a/crates/bevy_image/src/image.rs b/crates/bevy_image/src/image.rs index a2157357ed..c92f947c5f 100644 --- a/crates/bevy_image/src/image.rs +++ b/crates/bevy_image/src/image.rs @@ -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) diff --git a/crates/bevy_input/src/gamepad.rs b/crates/bevy_input/src/gamepad.rs index 7d2f551201..a448ec3d48 100644 --- a/crates/bevy_input/src/gamepad.rs +++ b/crates/bevy_input/src/gamepad.rs @@ -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::(); - info!("Gamepad {} disconnected.", id); + info!("Gamepad {id} disconnected."); } } } diff --git a/crates/bevy_input_focus/src/tab_navigation.rs b/crates/bevy_input_focus/src/tab_navigation.rs index ef018c56fb..6a8a24772d 100644 --- a/crates/bevy_input_focus/src/tab_navigation.rs +++ b/crates/bevy_input_focus/src/tab_navigation.rs @@ -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); diff --git a/crates/bevy_log/src/lib.rs b/crates/bevy_log/src/lib.rs index 7a80a21cc3..9a614d2b89 100644 --- a/crates/bevy_log/src/lib.rs +++ b/crates/bevy_log/src/lib.rs @@ -314,7 +314,7 @@ impl Plugin for LogPlugin { .and_then(|source| source.downcast_ref::()) .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::builder().parse_lossy(&default_filter)) diff --git a/crates/bevy_math/src/curve/mod.rs b/crates/bevy_math/src/curve/mod.rs index 94e7b0151e..c1c45e655b 100644 --- a/crates/bevy_math/src/curve/mod.rs +++ b/crates/bevy_math/src/curve/mod.rs @@ -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); diff --git a/crates/bevy_pbr/src/decal/forward.rs b/crates/bevy_pbr/src/decal/forward.rs index 7d82946346..757ecff2c3 100644 --- a/crates/bevy_pbr/src/decal/forward.rs +++ b/crates/bevy_pbr/src/decal/forward.rs @@ -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(()) diff --git a/crates/bevy_pbr/src/render/mesh_view_bindings.rs b/crates/bevy_pbr/src/render/mesh_view_bindings.rs index 8e231886ba..b995224b6b 100644 --- a/crates/bevy_pbr/src/render/mesh_view_bindings.rs +++ b/crates/bevy_pbr/src/render/mesh_view_bindings.rs @@ -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() + }, ) } } diff --git a/crates/bevy_remote/src/builtin_methods.rs b/crates/bevy_remote/src/builtin_methods.rs index 0bf3f9773b..615fdecc14 100644 --- a/crates/bevy_remote/src/builtin_methods.rs +++ b/crates/bevy_remote/src/builtin_methods.rs @@ -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, }); }; diff --git a/crates/bevy_render/src/view/mod.rs b/crates/bevy_render/src/view/mod.rs index b2b90d0b24..7596799061 100644 --- a/crates/bevy_render/src/view/mod.rs +++ b/crates/bevy_render/src/view/mod.rs @@ -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}"), } } } diff --git a/crates/bevy_scene/src/serde.rs b/crates/bevy_scene/src/serde.rs index cb8206d3dd..84badb5850 100644 --- a/crates/bevy_scene/src/serde.rs +++ b/crates/bevy_scene/src/serde.rs @@ -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 diff --git a/crates/bevy_state/src/app.rs b/crates/bevy_state/src/app.rs index 05116cbcc5..c13abceeb9 100644 --- a/crates/bevy_state/src/app.rs +++ b/crates/bevy_state/src/app.rs @@ -116,7 +116,7 @@ impl AppExtStates for SubApp { } } else { let name = core::any::type_name::(); - 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::(); - 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::(); - 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::>>() { let name = core::any::type_name::(); - 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 diff --git a/crates/bevy_state/src/commands.rs b/crates/bevy_state/src/commands.rs index d9da362b62..4617011726 100644 --- a/crates/bevy_state/src/commands.rs +++ b/crates/bevy_state/src/commands.rs @@ -21,7 +21,7 @@ impl CommandsStatesExt for Commands<'_, '_> { let mut next = w.resource_mut::>(); 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); diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index 77728543e7..6f61eae2de 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -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; } diff --git a/crates/bevy_winit/src/system.rs b/crates/bevy_winit/src/system.rs index 3cc7c5a5f6..6d3a76c9b3 100644 --- a/crates/bevy_winit/src/system.rs +++ b/crates/bevy_winit/src/system.rs @@ -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) diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index 5110e670c2..f238da2e20 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -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(()) } } diff --git a/examples/2d/bloom_2d.rs b/examples/2d/bloom_2d.rs index 9d9be1e5c7..9fb8791ed5 100644 --- a/examples/2d/bloom_2d.rs +++ b/examples/2d/bloom_2d.rs @@ -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) diff --git a/examples/3d/anisotropy.rs b/examples/3d/anisotropy.rs index 371612b2d2..edb0e92539 100644 --- a/examples/3d/anisotropy.rs +++ b/examples/3d/anisotropy.rs @@ -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() } } diff --git a/examples/3d/lighting.rs b/examples/3d/lighting.rs index 100816feb6..dfe4815d64 100644 --- a/examples/3d/lighting.rs +++ b/examples/3d/lighting.rs @@ -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"); } } diff --git a/examples/3d/occlusion_culling.rs b/examples/3d/occlusion_culling.rs index ecc14ca369..f0cdbffa2a 100644 --- a/examples/3d/occlusion_culling.rs +++ b/examples/3d/occlusion_culling.rs @@ -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" ); } } diff --git a/examples/3d/ssao.rs b/examples/3d/ssao.rs index 687288b1f5..072c963bef 100644 --- a/examples/3d/ssao.rs +++ b/examples/3d/ssao.rs @@ -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" )); } diff --git a/examples/animation/animation_masks.rs b/examples/animation/animation_masks.rs index 05b50711fe..613e85eb2f 100644 --- a/examples/animation/animation_masks.rs +++ b/examples/animation/animation_masks.rs @@ -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 { diff --git a/examples/animation/easing_functions.rs b/examples/animation/easing_functions.rs index 853846f059..d900627875 100644 --- a/examples/animation/easing_functions.rs +++ b/examples/animation/easing_functions.rs @@ -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(); diff --git a/examples/ecs/entity_disabling.rs b/examples/ecs/entity_disabling.rs index 362b655dfb..3fc895cd09 100644 --- a/examples/ecs/entity_disabling.rs +++ b/examples/ecs/entity_disabling.rs @@ -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() { diff --git a/examples/ecs/relationships.rs b/examples/ecs/relationships.rs index 13542974c8..5b85516428 100644 --- a/examples/ecs/relationships.rs +++ b/examples/ecs/relationships.rs @@ -104,7 +104,7 @@ fn main() { )); } - println!("{}", relationships); + println!("{relationships}"); } world.run_system_once(debug_relationships).unwrap(); diff --git a/examples/remote/client.rs b/examples/remote/client.rs index 4225ce22ab..c4ededd163 100644 --- a/examples/remote/client.rs +++ b/examples/remote/client.rs @@ -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::()?; - println!("{:#}", res); + println!("{res:#}"); Ok(()) } diff --git a/examples/scene/scene.rs b/examples/scene/scene.rs index e0072df170..de1601ba8d 100644 --- a/examples/scene/scene.rs +++ b/examples/scene/scene.rs @@ -232,7 +232,7 @@ fn infotext_system(mut commands: Commands) { fn panic_on_fail(scenes: Query<&DynamicSceneRoot>, asset_server: Res) { 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}"); } } } diff --git a/examples/stress_tests/many_components.rs b/examples/stress_tests/many_components.rs index 59720f3b5a..6c5b3f9452 100644 --- a/examples/stress_tests/many_components.rs +++ b/examples/stress_tests/many_components.rs @@ -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::(), None, @@ -180,10 +180,7 @@ fn main() { .nth(1) .and_then(|string| string.parse::().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::().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 }); diff --git a/examples/tools/gamepad_viewer.rs b/examples/tools/gamepad_viewer.rs index 73cd446809..c49bad495b 100644 --- a/examples/tools/gamepad_viewer.rs +++ b/examples/tools/gamepad_viewer.rs @@ -443,7 +443,7 @@ fn update_connected( let formatted = gamepads .iter() - .map(|(entity, name)| format!("{} - {}", entity, name)) + .map(|(entity, name)| format!("{entity} - {name}")) .collect::>() .join("\n"); diff --git a/examples/ui/box_shadow.rs b/examples/ui/box_shadow.rs index ee00656e7f..9c1dd745be 100644 --- a/examples/ui/box_shadow.rs +++ b/examples/ui/box_shadow.rs @@ -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}"), }; ( diff --git a/examples/ui/directional_navigation.rs b/examples/ui/directional_navigation.rs index 28b0e123f6..7b82fd71c3 100644 --- a/examples/ui/directional_navigation.rs +++ b/examples/ui/directional_navigation.rs @@ -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(( diff --git a/examples/ui/gradients.rs b/examples/ui/gradients.rs index 0adc930a34..72b915813c 100644 --- a/examples/ui/gradients.rs +++ b/examples/ui/gradients.rs @@ -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(); diff --git a/examples/ui/tab_navigation.rs b/examples/ui/tab_navigation.rs index c04a6abc3d..1dd131def9 100644 --- a/examples/ui/tab_navigation.rs +++ b/examples/ui/tab_navigation.rs @@ -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() diff --git a/examples/usage/context_menu.rs b/examples/usage/context_menu.rs index b4ade6063b..a50e5cdabb 100644 --- a/examples/usage/context_menu.rs +++ b/examples/usage/context_menu.rs @@ -124,7 +124,7 @@ fn on_trigger_menu(trigger: On, 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 {