3d convex_hull contains an undocumented panic
- Dominant language
- Rust
- Stars
- 926
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
It's generally a bad idea to include panics in a public function unless those panics are documented.
https://github.com/rustsim/ncollide/blob/3fd441c024f0057fd3742e3cb911f4716b230892/src/transformation/convex_hull3.rs#L26-L31
The function panics when length of input is zero.
Possible solutions:
1. Handle the zero length case by returning an empty mesh.
2. Handle the zero length case by returning an Option::None.
3. Change the type signature to statically disallow empty input.
4. Document the panic condition. See [this part of the rust std](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.swap_remove) for an idiomatic example.
I recommend 1 or 4 as they don't introduce breaking api changes.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.