Skip to content

Commit

Permalink
adjust to new clippy lints (#826)
Browse files Browse the repository at this point in the history
  • Loading branch information
cart authored Nov 9, 2020
1 parent 07f07a0 commit 4ef6eb8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
10 changes: 5 additions & 5 deletions crates/bevy_core/src/task_pool_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ impl Default for DefaultTaskPoolOptions {
impl DefaultTaskPoolOptions {
/// Create a configuration that forces using the given number of threads.
pub fn with_num_threads(thread_count: usize) -> Self {
let mut options = Self::default();
options.min_total_threads = thread_count;
options.max_total_threads = thread_count;

options
DefaultTaskPoolOptions {
min_total_threads: thread_count,
max_total_threads: thread_count,
..Default::default()
}
}

/// Inserts the default thread pools into the given resource map based on the configured values
Expand Down
26 changes: 15 additions & 11 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,16 @@ fn load_node(
gltf::camera::Projection::Orthographic(orthographic) => {
let xmag = orthographic.xmag();
let ymag = orthographic.ymag();
let mut orthographic_projection: OrthographicProjection = Default::default();
orthographic_projection.left = -xmag;
orthographic_projection.right = xmag;
orthographic_projection.top = ymag;
orthographic_projection.bottom = -ymag;
orthographic_projection.far = orthographic.zfar();
orthographic_projection.near = orthographic.znear();
orthographic_projection.get_projection_matrix();
let orthographic_projection: OrthographicProjection = OrthographicProjection {
left: -xmag,
right: xmag,
top: ymag,
bottom: -ymag,
far: orthographic.zfar(),
near: orthographic.znear(),
..Default::default()
};

node.with(Camera {
name: Some(base::camera::CAMERA2D.to_owned()),
projection_matrix: orthographic_projection.get_projection_matrix(),
Expand All @@ -246,9 +248,11 @@ fn load_node(
node.with(orthographic_projection);
}
gltf::camera::Projection::Perspective(perspective) => {
let mut perspective_projection: PerspectiveProjection = Default::default();
perspective_projection.fov = perspective.yfov();
perspective_projection.near = perspective.znear();
let mut perspective_projection: PerspectiveProjection = PerspectiveProjection {
fov: perspective.yfov(),
near: perspective.znear(),
..Default::default()
};
if let Some(zfar) = perspective.zfar() {
perspective_projection.far = zfar;
}
Expand Down
6 changes: 4 additions & 2 deletions crates/bevy_render/src/texture/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ impl Texture {
}

pub fn new_fill(size: Vec2, pixel: &[u8], format: TextureFormat) -> Self {
let mut value = Self::default();
value.format = format;
let mut value = Texture {
format,
..Default::default()
};
value.resize(size);

debug_assert_eq!(
Expand Down
11 changes: 5 additions & 6 deletions crates/bevy_scene/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ impl<'a, 'de> DeserializeSeed<'de> for SceneDeserializer<'a> {
where
D: serde::Deserializer<'de>,
{
let mut scene = DynamicScene::default();
scene.entities = deserializer.deserialize_seq(SceneEntitySeqVisitor {
property_type_registry: self.property_type_registry,
})?;

Ok(scene)
Ok(DynamicScene {
entities: deserializer.deserialize_seq(SceneEntitySeqVisitor {
property_type_registry: self.property_type_registry,
})?,
})
}
}

Expand Down

0 comments on commit 4ef6eb8

Please sign in to comment.