From e50c4fd5b95fc0b127e14fbcf80b6ff981da1785 Mon Sep 17 00:00:00 2001 From: Walther Date: Tue, 26 Nov 2024 18:36:41 +0200 Subject: [PATCH] chore: remove a couple of unwraps, replace with expects --- clovers/src/hitable.rs | 2 +- clovers/src/objects/gltf.rs | 2 +- clovers/src/objects/ply.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clovers/src/hitable.rs b/clovers/src/hitable.rs index 4d7c182b..e876d578 100644 --- a/clovers/src/hitable.rs +++ b/clovers/src/hitable.rs @@ -143,7 +143,7 @@ impl<'scene> HitableList<'scene> { /// This method may panic if no finite bounding box can be created for the given `hitables`. #[must_use] pub fn new(hitables: Vec>) -> Self { - let aabb = vec_bounding_box(&hitables).unwrap(); + let aabb = vec_bounding_box(&hitables).expect("No bounding box for hitables"); Self { hitables, aabb } } diff --git a/clovers/src/objects/gltf.rs b/clovers/src/objects/gltf.rs index 28a53817..59a099e0 100644 --- a/clovers/src/objects/gltf.rs +++ b/clovers/src/objects/gltf.rs @@ -72,7 +72,7 @@ impl<'scene> GLTF<'scene> { /// This method may panic if no finite bounding box can be created for the given `hitables`. pub fn new(gltf_init: GLTFInit) -> Self { let hitables: Vec = gltf_init.into(); - let aabb = vec_bounding_box(&hitables).unwrap(); + let aabb = vec_bounding_box(&hitables).expect("No bounding box for hitables"); GLTF { hitables, aabb } } diff --git a/clovers/src/objects/ply.rs b/clovers/src/objects/ply.rs index 76d46f9a..fd28a0b3 100644 --- a/clovers/src/objects/ply.rs +++ b/clovers/src/objects/ply.rs @@ -108,7 +108,7 @@ pub fn initialize_ply<'scene>( hitables.push(Hitable::Triangle(triangle)); } // TODO: remove unwrap - let aabb = vec_bounding_box(&hitables).unwrap(); + let aabb = vec_bounding_box(&hitables).expect("No bounding box for hitables"); PLY { hitables,