From 80743a4c263f5353daf08e39632e9123f907d557 Mon Sep 17 00:00:00 2001 From: redpenguinyt Date: Wed, 17 Jan 2024 20:23:24 +0000 Subject: [PATCH] made clippy happy - just disabled `clippy::excessive_precision` lint for `validate_cornell`test --- examples/print_mesh.rs | 7 +++---- src/lib.rs | 4 ++-- src/tests.rs | 7 ++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/print_mesh.rs b/examples/print_mesh.rs index 350284b..808518e 100644 --- a/examples/print_mesh.rs +++ b/examples/print_mesh.rs @@ -1,11 +1,10 @@ fn main() { let obj_file = std::env::args() - .skip(1) - .next() + .nth(1) .expect("A .obj file to print is required"); let (models, materials) = - tobj::load_obj(&obj_file, &tobj::LoadOptions::default()).expect("Failed to OBJ load file"); + tobj::load_obj(obj_file, &tobj::LoadOptions::default()).expect("Failed to OBJ load file"); // Note: If you don't mind missing the materials, you can generate a default. let materials = materials.expect("Failed to load MTL file"); @@ -15,7 +14,7 @@ fn main() { for (i, m) in models.iter().enumerate() { let mesh = &m.mesh; - println!(""); + println!(); println!("model[{}].name = \'{}\'", i, m.name); println!("model[{}].mesh.material_id = {:?}", i, mesh.material_id); diff --git a/src/lib.rs b/src/lib.rs index afc0d96..b67d876 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -931,7 +931,7 @@ fn export_faces( } Face::Polygon(ref indices) => { if load_options.triangulate { - let a = indices.get(0).ok_or(LoadError::InvalidPolygon)?; + let a = indices.first().ok_or(LoadError::InvalidPolygon)?; let mut b = indices.get(1).ok_or(LoadError::InvalidPolygon)?; for c in indices.iter().skip(2) { add_vertex(&mut mesh, &mut index_map, a, pos, v_color, texcoord, normal)?; @@ -1327,7 +1327,7 @@ fn export_faces_multi_index( } Face::Polygon(ref indices) => { if load_options.triangulate { - let a = indices.get(0).ok_or(LoadError::InvalidPolygon)?; + let a = indices.first().ok_or(LoadError::InvalidPolygon)?; let mut b = indices.get(1).ok_or(LoadError::InvalidPolygon)?; for c in indices.iter().skip(2) { add_vertex_multi_index( diff --git a/src/tests.rs b/src/tests.rs index 9bd8427..1c8ccfb 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -7,9 +7,9 @@ use std::{ use crate as tobj; -const CORNELL_BOX_OBJ: &'static str = include_str!("../obj/cornell_box.obj"); -const CORNELL_BOX_MTL1: &'static str = include_str!("../obj/cornell_box.mtl"); -const CORNELL_BOX_MTL2: &'static str = include_str!("../obj/cornell_box2.mtl"); +const CORNELL_BOX_OBJ: &str = include_str!("../obj/cornell_box.obj"); +const CORNELL_BOX_MTL1: &str = include_str!("../obj/cornell_box.mtl"); +const CORNELL_BOX_MTL2: &str = include_str!("../obj/cornell_box2.mtl"); // Set the tolerance for float comparison use crate::Float; @@ -271,6 +271,7 @@ fn multiple_face_formats() { assert!(tri.texcoords.is_empty()); } +#[allow(clippy::excessive_precision)] fn validate_cornell(models: Vec, mats: Vec) { // Verify the floor loaded properly assert_eq!(models[0].name, "floor");