Skip to content

Commit

Permalink
chore: remove a couple of unwraps, replace with expects
Browse files Browse the repository at this point in the history
  • Loading branch information
Walther committed Nov 26, 2024
1 parent 4f5010e commit e50c4fd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clovers/src/hitable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Hitable<'scene>>) -> Self {
let aabb = vec_bounding_box(&hitables).unwrap();
let aabb = vec_bounding_box(&hitables).expect("No bounding box for hitables");
Self { hitables, aabb }
}

Expand Down
2 changes: 1 addition & 1 deletion clovers/src/objects/gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Hitable> = 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 }
}
Expand Down
2 changes: 1 addition & 1 deletion clovers/src/objects/ply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e50c4fd

Please sign in to comment.