diff --git a/benches/benches/bevy_ecs/change_detection.rs b/benches/benches/bevy_ecs/change_detection.rs index 3f9f1d4bc1..7414dae65f 100644 --- a/benches/benches/bevy_ecs/change_detection.rs +++ b/benches/benches/bevy_ecs/change_detection.rs @@ -95,7 +95,7 @@ fn all_added_detection_generic(group: &mut BenchGroup, e }, |(ref mut world, ref mut query)| { let mut count = 0; - for entity in query.iter(&world) { + for entity in query.iter(world) { black_box(entity); count += 1; } @@ -143,7 +143,7 @@ fn all_changed_detection_generic + Default + }, |(ref mut world, ref mut query)| { let mut count = 0; - for entity in query.iter(&world) { + for entity in query.iter(world) { black_box(entity); count += 1; } @@ -195,7 +195,7 @@ fn few_changed_detection_generic + Default + (world, query) }, |(ref mut world, ref mut query)| { - for entity in query.iter(&world) { + for entity in query.iter(world) { black_box(entity); } }, @@ -237,7 +237,7 @@ fn none_changed_detection_generic + Default>( }, |(ref mut world, ref mut query)| { let mut count = 0; - for entity in query.iter(&world) { + for entity in query.iter(world) { black_box(entity); count += 1; } @@ -341,7 +341,7 @@ fn multiple_archetype_none_changed_detection_generic Event for TestEvent { const AUTO_PROPAGATE: bool = true; } -fn send_events(world: &mut World, leaves: &Vec) { +fn send_events(world: &mut World, leaves: &[Entity]) { let target = leaves.iter().choose(&mut rand::thread_rng()).unwrap(); (0..N_EVENTS).for_each(|_| { @@ -100,9 +100,9 @@ fn spawn_listener_hierarchy(world: &mut World) -> (Vec, Vec, Vec } fn add_listeners_to_hierarchy( - roots: &Vec, - leaves: &Vec, - nodes: &Vec, + roots: &[Entity], + leaves: &[Entity], + nodes: &[Entity], world: &mut World, ) { for e in roots.iter() { diff --git a/benches/benches/bevy_ecs/scheduling/run_condition.rs b/benches/benches/bevy_ecs/scheduling/run_condition.rs index c88d89b1fe..0d6e4107c6 100644 --- a/benches/benches/bevy_ecs/scheduling/run_condition.rs +++ b/benches/benches/bevy_ecs/scheduling/run_condition.rs @@ -25,7 +25,7 @@ pub fn run_condition_yes(criterion: &mut Criterion) { } // run once to initialize systems schedule.run(&mut world); - group.bench_function(&format!("{:03}_systems", 5 * amount + 1), |bencher| { + group.bench_function(format!("{:03}_systems", 5 * amount + 1), |bencher| { bencher.iter(|| { schedule.run(&mut world); }); @@ -48,7 +48,7 @@ pub fn run_condition_no(criterion: &mut Criterion) { } // run once to initialize systems schedule.run(&mut world); - group.bench_function(&format!("{:03}_systems", 5 * amount + 1), |bencher| { + group.bench_function(format!("{:03}_systems", 5 * amount + 1), |bencher| { bencher.iter(|| { schedule.run(&mut world); }); @@ -80,7 +80,7 @@ pub fn run_condition_yes_with_query(criterion: &mut Criterion) { } // run once to initialize systems schedule.run(&mut world); - group.bench_function(&format!("{:03}_systems", 5 * amount + 1), |bencher| { + group.bench_function(format!("{:03}_systems", 5 * amount + 1), |bencher| { bencher.iter(|| { schedule.run(&mut world); }); @@ -109,7 +109,7 @@ pub fn run_condition_yes_with_resource(criterion: &mut Criterion) { } // run once to initialize systems schedule.run(&mut world); - group.bench_function(&format!("{:03}_systems", 5 * amount + 1), |bencher| { + group.bench_function(format!("{:03}_systems", 5 * amount + 1), |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 d2ea51307f..4a14553885 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!("{:03}_systems", amount), |bencher| { + group.bench_function(format!("{:03}_systems", amount), |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!("{:03}_systems", 5 * amount), |bencher| { + group.bench_function(format!("{:03}_systems", 5 * amount), |bencher| { bencher.iter(|| { schedule.run(&mut world); }); @@ -80,7 +80,7 @@ pub fn busy_systems(criterion: &mut Criterion) { } schedule.run(&mut world); group.bench_function( - &format!( + format!( "{:02}x_entities_{:02}_systems", entity_bunches, 3 * system_amount + 3 @@ -131,7 +131,7 @@ pub fn contrived(criterion: &mut Criterion) { } schedule.run(&mut world); group.bench_function( - &format!( + format!( "{:02}x_entities_{:02}_systems", entity_bunches, 3 * system_amount + 3 diff --git a/benches/benches/bevy_ecs/scheduling/schedule.rs b/benches/benches/bevy_ecs/scheduling/schedule.rs index 4571899a9b..1a428b5eb8 100644 --- a/benches/benches/bevy_ecs/scheduling/schedule.rs +++ b/benches/benches/bevy_ecs/scheduling/schedule.rs @@ -74,7 +74,7 @@ pub fn build_schedule(criterion: &mut Criterion) { // Method: generate a set of `graph_size` systems which have a One True Ordering. // Add system to the schedule with full constraints. Hopefully this should be maximally // difficult for bevy to figure out. - let labels: Vec<_> = (0..1000).map(|i| NumSet(i)).collect(); + let labels: Vec<_> = (0..1000).map(NumSet).collect(); // Benchmark graphs of different sizes. for graph_size in [100, 500, 1000] { diff --git a/benches/benches/bevy_ecs/world/world_get.rs b/benches/benches/bevy_ecs/world/world_get.rs index 4c235cd1b4..190402fbad 100644 --- a/benches/benches/bevy_ecs/world/world_get.rs +++ b/benches/benches/bevy_ecs/world/world_get.rs @@ -306,7 +306,7 @@ pub fn query_get(criterion: &mut Criterion) { } pub fn query_get_many(criterion: &mut Criterion) { - let mut group = criterion.benchmark_group(&format!("query_get_many_{N}")); + let mut group = criterion.benchmark_group(format!("query_get_many_{N}")); group.warm_up_time(core::time::Duration::from_millis(500)); group.measurement_time(core::time::Duration::from_secs(2 * N as u64)); diff --git a/benches/benches/bevy_reflect/main.rs b/benches/benches/bevy_reflect/main.rs index 3785652295..d347baccd0 100644 --- a/benches/benches/bevy_reflect/main.rs +++ b/benches/benches/bevy_reflect/main.rs @@ -1,3 +1,5 @@ +#![expect(clippy::type_complexity)] + use criterion::criterion_main; mod function; diff --git a/benches/benches/bevy_reflect/path.rs b/benches/benches/bevy_reflect/path.rs index fa5582982b..2cca245239 100644 --- a/benches/benches/bevy_reflect/path.rs +++ b/benches/benches/bevy_reflect/path.rs @@ -17,7 +17,7 @@ fn deterministic_rand() -> ChaCha8Rng { ChaCha8Rng::seed_from_u64(42) } fn random_ident(rng: &mut ChaCha8Rng, f: &mut dyn Write) { - let between = Uniform::try_from(b'a'..=b'z').unwrap(); + let between = Uniform::from(b'a'..=b'z'); let ident_size = rng.gen_range(1..128); let ident: Vec = rng.sample_iter(between).take(ident_size).collect(); let ident = str::from_utf8(&ident).unwrap(); @@ -79,9 +79,9 @@ fn parse_reflect_path(criterion: &mut Criterion) { BenchmarkId::new("parse_reflect_path", size), &size, |bencher, &size| { - let mut mk_paths = mk_paths(size); + let mk_paths = mk_paths(size); bencher.iter_batched( - || mk_paths(), + mk_paths, |path| assert!(ParsedPath::parse(black_box(&path)).is_ok()), BatchSize::SmallInput, );