Skip to content

Commit e68b5ce

Browse files
committed
cargo fmt
1 parent 11e9996 commit e68b5ce

File tree

8 files changed

+32
-10
lines changed

8 files changed

+32
-10
lines changed

crates/bevy_math/src/sampling/mesh_sampling.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ use crate::{
66
};
77
use alloc::vec::Vec;
88
use rand::Rng;
9-
use rand_distr::{Distribution, weighted::{WeightedAliasIndex, Error as WeightedError}};
9+
use rand_distr::{
10+
weighted::{Error as WeightedError, WeightedAliasIndex},
11+
Distribution,
12+
};
1013

1114
/// A [distribution] that caches data to allow fast sampling from a collection of triangles.
1215
/// Generally used through [`sample`] or [`sample_iter`].

crates/bevy_math/src/sampling/shape_sampling.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use core::f32::consts::{PI, TAU};
4242

4343
use crate::{ops, primitives::*, NormedVectorSpace, Vec2, Vec3};
4444
use rand::{
45-
distr::{Distribution, weighted::WeightedIndex},
45+
distr::{weighted::WeightedIndex, Distribution},
4646
Rng,
4747
};
4848

@@ -201,7 +201,8 @@ impl ShapeSample for Annulus {
201201
let outer_radius = self.outer_circle.radius;
202202

203203
// Like random sampling for a circle, radius is weighted by the square.
204-
let r_squared = rng.random_range((inner_radius * inner_radius)..(outer_radius * outer_radius));
204+
let r_squared =
205+
rng.random_range((inner_radius * inner_radius)..(outer_radius * outer_radius));
205206
let r = ops::sqrt(r_squared);
206207
let theta = rng.random_range(0.0..TAU);
207208
let (sin, cos) = ops::sin_cos(theta);

examples/ecs/fallible_params.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ fn user_input(
8989
let texture = asset_server.load("textures/simplespace/enemy_A.png");
9090
commands.spawn((
9191
Enemy {
92-
origin: Vec2::new(rng.random_range(-200.0..200.0), rng.random_range(-200.0..200.0)),
92+
origin: Vec2::new(
93+
rng.random_range(-200.0..200.0),
94+
rng.random_range(-200.0..200.0),
95+
),
9396
radius: rng.random_range(50.0..150.0),
9497
rotation: rng.random_range(0.0..std::f32::consts::TAU),
9598
rotation_speed: rng.random_range(0.5..1.5),

examples/ecs/observer_propagation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::time::Duration;
44

55
use bevy::{log::LogPlugin, prelude::*, time::common_conditions::on_timer};
6-
use rand::{seq::IteratorRandom, rng, Rng};
6+
use rand::{rng, seq::IteratorRandom, Rng};
77

88
fn main() {
99
App::new()

examples/stress_tests/bevymark.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,12 @@ fn init_textures(textures: &mut Vec<Handle<Image>>, args: &Args, images: &mut As
575575
// This isn't strictly required in practical use unless you need your app to be deterministic.
576576
let mut color_rng = ChaCha8Rng::seed_from_u64(42);
577577
while textures.len() < args.material_texture_count {
578-
let pixel = [color_rng.random(), color_rng.random(), color_rng.random(), 255];
578+
let pixel = [
579+
color_rng.random(),
580+
color_rng.random(),
581+
color_rng.random(),
582+
255,
583+
];
579584
textures.push(images.add(Image::new_fill(
580585
Extent3d {
581586
width: BIRD_TEXTURE_SIZE as u32,

examples/stress_tests/many_components.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use bevy::{
2727
MinimalPlugins,
2828
};
2929

30-
use rand::prelude::{Rng, SeedableRng, IndexedRandom};
30+
use rand::prelude::{IndexedRandom, Rng, SeedableRng};
3131
use rand_chacha::ChaCha8Rng;
3232
use std::{alloc::Layout, mem::ManuallyDrop, num::Wrapping};
3333

examples/stress_tests/many_cubes.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,13 @@ fn init_textures(args: &Args, images: &mut Assets<Image>) -> Vec<Handle<Image>>
262262
// This isn't strictly required in practical use unless you need your app to be deterministic.
263263
let mut color_rng = ChaCha8Rng::seed_from_u64(42);
264264
let color_bytes: Vec<u8> = (0..(args.material_texture_count * 4))
265-
.map(|i| if (i % 4) == 3 { 255 } else { color_rng.random() })
265+
.map(|i| {
266+
if (i % 4) == 3 {
267+
255
268+
} else {
269+
color_rng.random()
270+
}
271+
})
266272
.collect();
267273
color_bytes
268274
.chunks(4)
@@ -311,7 +317,11 @@ fn init_materials(
311317
materials.extend(
312318
std::iter::repeat_with(|| {
313319
assets.add(StandardMaterial {
314-
base_color: Color::srgb_u8(color_rng.random(), color_rng.random(), color_rng.random()),
320+
base_color: Color::srgb_u8(
321+
color_rng.random(),
322+
color_rng.random(),
323+
color_rng.random(),
324+
),
315325
base_color_texture: textures.choose(&mut texture_rng).cloned(),
316326
..default()
317327
})

examples/stress_tests/many_text2d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use bevy::{
1212

1313
use argh::FromArgs;
1414
use rand::{
15-
seq::{IteratorRandom, IndexedRandom},
15+
seq::{IndexedRandom, IteratorRandom},
1616
Rng, SeedableRng,
1717
};
1818
use rand_chacha::ChaCha8Rng;

0 commit comments

Comments
 (0)