Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ahash to 0.8.7 (0.8.3 has been yanked) and made clippy happy #62

Merged
merged 2 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use_f64 = []

[dependencies]
arbitrary = { version = "1.3.0", optional = true }
ahash = { version = "0.8.3", optional = true }
ahash = { version = "0.8.7", optional = true }
log = { version = "0.4.17", optional = true }

[dev-dependencies]
Expand Down
7 changes: 3 additions & 4 deletions examples/print_mesh.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -271,6 +271,7 @@ fn multiple_face_formats() {
assert!(tri.texcoords.is_empty());
}

#[allow(clippy::excessive_precision)]
fn validate_cornell(models: Vec<tobj::Model>, mats: Vec<tobj::Material>) {
// Verify the floor loaded properly
assert_eq!(models[0].name, "floor");
Expand Down
Loading