From c121d94f0b27bc04ffbdca55cd0939c1401d5a2e Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 27 Jan 2025 15:26:00 +0100 Subject: clippy: fixes and ignores --- world/src/mesh.rs | 59 ++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) (limited to 'world/src/mesh.rs') diff --git a/world/src/mesh.rs b/world/src/mesh.rs index b8dc0c3..4e6317d 100644 --- a/world/src/mesh.rs +++ b/world/src/mesh.rs @@ -38,7 +38,7 @@ pub fn import_mesh( texture_cache: &TextureCache, armatures: &[Option], ) -> Result<()> { - Ok(for p in mesh.primitives() { + for p in mesh.primitives() { let name = mesh.name().or(node.name()).map(|e| e.to_owned()); if let Some(name) = &name { info!("adding mesh {name:?}"); @@ -52,7 +52,7 @@ pub fn import_mesh( .map(|iter| { let a = iter.map(|[x, y, z]| vec3a(x, y, z)).collect::>(); debug!("{} vertex positions", a.len()); - Ok::<_, anyhow::Error>(store.set(&a)?) + store.set(&a) }) .transpose()?; @@ -61,7 +61,7 @@ pub fn import_mesh( .map(|iter| { let a = iter.map(|[x, y, z]| vec3a(x, y, z)).collect::>(); debug!("{} vertex normals", a.len()); - Ok::<_, anyhow::Error>(store.set(&a)?) + store.set(&a) }) .transpose()?; @@ -71,7 +71,7 @@ pub fn import_mesh( // TODO dont ignore handedness let a = iter.map(|[x, y, z, _h]| vec3a(x, y, z)).collect::>(); debug!("{} vertex tangents", a.len()); - Ok::<_, anyhow::Error>(store.set(&a)?) + store.set(&a) }) .transpose()?; @@ -80,7 +80,7 @@ pub fn import_mesh( .map(|iter| { let a = iter.into_u16().collect::>(); debug!("{} vertex joint indecies", a.len()); - Ok::<_, anyhow::Error>(store.set(&a)?) + store.set(&a) }) .transpose()?; @@ -89,7 +89,7 @@ pub fn import_mesh( .map(|iter| { let a = iter.into_f32().collect::>(); debug!("{} vertex joint weights", a.len()); - Ok::<_, anyhow::Error>(store.set(&a)?) + store.set(&a) }) .transpose()?; @@ -98,7 +98,7 @@ pub fn import_mesh( .map(|iter| { let a = iter.into_f32().map(|[x, y]| vec2(x, y)).collect::>(); debug!("{} vertex texture coordinates", a.len()); - Ok::<_, anyhow::Error>(store.set(&a)?) + store.set(&a) }) .transpose()?; @@ -110,7 +110,7 @@ pub fn import_mesh( .map(|[x, y, z]| vec3a(x, y, z)) .collect::>(); debug!("{} vertex colors", a.len()); - Ok::<_, anyhow::Error>(store.set(&a)?) + store.set(&a) }) .transpose()?; @@ -147,9 +147,9 @@ pub fn import_mesh( if let Some(tex) = p.material().pbr_metallic_roughness().base_color_texture() { let r = load_texture( "albedo", - &store, + store, path_base, - &buffers, + buffers, &tex.texture().source().source(), args.webp, texture_cache, @@ -161,9 +161,9 @@ pub fn import_mesh( if let Some(tex) = p.material().normal_texture() { tex_normal = Some(load_texture( "normal", - &store, + store, path_base, - &buffers, + buffers, &tex.texture().source().source(), args.webp, texture_cache, @@ -173,9 +173,9 @@ pub fn import_mesh( if let Some(tex) = p.material().emissive_texture() { tex_emission = Some(load_texture( "emission", - &store, + store, path_base, - &buffers, + buffers, &tex.texture().source().source(), args.webp, texture_cache, @@ -185,14 +185,13 @@ pub fn import_mesh( if let Some(tex) = p .material() .transmission() - .map(|t| t.transmission_texture()) - .flatten() + .and_then(|t| t.transmission_texture()) { tex_transmission = Some(load_texture( "transmission", - &store, + store, path_base, - &buffers, + buffers, &tex.texture().source().source(), args.webp, texture_cache, @@ -202,14 +201,13 @@ pub fn import_mesh( if let Some(tex) = p .material() .volume() - .map(|t| t.thickness_texture()) - .flatten() + .and_then(|t| t.thickness_texture()) { tex_thickness = Some(load_texture( "thickness", - &store, + store, path_base, - &buffers, + buffers, &tex.texture().source().source(), args.webp, texture_cache, @@ -219,9 +217,9 @@ pub fn import_mesh( if let Some(tex) = p.material().occlusion_texture() { tex_occlusion = Some(load_texture( "occlusion", - &store, + store, path_base, - &buffers, + buffers, &tex.texture().source().source(), args.webp, texture_cache, @@ -236,9 +234,9 @@ pub fn import_mesh( { let r = load_texture( "metallic+roughness", - &store, + store, path_base, - &buffers, + buffers, &tex.texture().source().source(), args.webp, texture_cache, @@ -299,10 +297,8 @@ pub fn import_mesh( let g_dispersion = p .material() .extension_value("KHR_materials_dispersion") - .map(|e| e.get("dispersion")) - .flatten() - .map(|e| e.as_f64()) - .flatten() + .and_then(|e| e.get("dispersion")) + .and_then(|e| e.as_f64()) .map(|e| e as f32); if let Some(d) = g_dispersion { debug!("dispersion is {d}"); @@ -391,5 +387,6 @@ pub fn import_mesh( })?; prefab.mesh.push((trans, mesh)) - }) + }; + Ok(()) } -- cgit v1.2.3-70-g09d2