adjust to new clippy lints (#826)

This commit is contained in:
Carter Anderson 2020-11-09 14:12:42 -08:00 committed by GitHub
parent 07f07a0736
commit 4ef6eb8a85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 24 deletions

View file

@ -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

View file

@ -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(),
@ -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;
}

View file

@ -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!(

View file

@ -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,
})?,
})
}
}