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 { impl DefaultTaskPoolOptions {
/// Create a configuration that forces using the given number of threads. /// Create a configuration that forces using the given number of threads.
pub fn with_num_threads(thread_count: usize) -> Self { pub fn with_num_threads(thread_count: usize) -> Self {
let mut options = Self::default(); DefaultTaskPoolOptions {
options.min_total_threads = thread_count; min_total_threads: thread_count,
options.max_total_threads = thread_count; max_total_threads: thread_count,
..Default::default()
options }
} }
/// Inserts the default thread pools into the given resource map based on the configured values /// 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) => { gltf::camera::Projection::Orthographic(orthographic) => {
let xmag = orthographic.xmag(); let xmag = orthographic.xmag();
let ymag = orthographic.ymag(); let ymag = orthographic.ymag();
let mut orthographic_projection: OrthographicProjection = Default::default(); let orthographic_projection: OrthographicProjection = OrthographicProjection {
orthographic_projection.left = -xmag; left: -xmag,
orthographic_projection.right = xmag; right: xmag,
orthographic_projection.top = ymag; top: ymag,
orthographic_projection.bottom = -ymag; bottom: -ymag,
orthographic_projection.far = orthographic.zfar(); far: orthographic.zfar(),
orthographic_projection.near = orthographic.znear(); near: orthographic.znear(),
orthographic_projection.get_projection_matrix(); ..Default::default()
};
node.with(Camera { node.with(Camera {
name: Some(base::camera::CAMERA2D.to_owned()), name: Some(base::camera::CAMERA2D.to_owned()),
projection_matrix: orthographic_projection.get_projection_matrix(), projection_matrix: orthographic_projection.get_projection_matrix(),
@ -246,9 +248,11 @@ fn load_node(
node.with(orthographic_projection); node.with(orthographic_projection);
} }
gltf::camera::Projection::Perspective(perspective) => { gltf::camera::Projection::Perspective(perspective) => {
let mut perspective_projection: PerspectiveProjection = Default::default(); let mut perspective_projection: PerspectiveProjection = PerspectiveProjection {
perspective_projection.fov = perspective.yfov(); fov: perspective.yfov(),
perspective_projection.near = perspective.znear(); near: perspective.znear(),
..Default::default()
};
if let Some(zfar) = perspective.zfar() { if let Some(zfar) = perspective.zfar() {
perspective_projection.far = zfar; perspective_projection.far = zfar;
} }

View File

@ -48,8 +48,10 @@ impl Texture {
} }
pub fn new_fill(size: Vec2, pixel: &[u8], format: TextureFormat) -> Self { pub fn new_fill(size: Vec2, pixel: &[u8], format: TextureFormat) -> Self {
let mut value = Self::default(); let mut value = Texture {
value.format = format; format,
..Default::default()
};
value.resize(size); value.resize(size);
debug_assert_eq!( debug_assert_eq!(

View File

@ -92,12 +92,11 @@ impl<'a, 'de> DeserializeSeed<'de> for SceneDeserializer<'a> {
where where
D: serde::Deserializer<'de>, D: serde::Deserializer<'de>,
{ {
let mut scene = DynamicScene::default(); Ok(DynamicScene {
scene.entities = deserializer.deserialize_seq(SceneEntitySeqVisitor { entities: deserializer.deserialize_seq(SceneEntitySeqVisitor {
property_type_registry: self.property_type_registry, property_type_registry: self.property_type_registry,
})?; })?,
})
Ok(scene)
} }
} }