GuillaumeGomez / rust-GSL

A GSL (the GNU Scientific Library) binding for Rust
190 stars 46 forks source link

Mark bernoulli_pdf function as unsafe #128

Open kitcatier opened 1 year ago

kitcatier commented 1 year ago

https://github.com/GuillaumeGomez/rust-GSL/blob/234cfc26deef8b096e5e8c6a34e0463f5e89bc74/src/randist/bernoulli.rs#L7-L9 Hello, it is not a good choice to mark the entire function body as unsafe, which will make the caller ignore the safety requirements that the function parameters must guarantee, the developer who calls the bernoulli_pdf function may not notice this safety requirement.

Marking them unsafe also means that callers must make sure they know what they're doing.

GuillaumeGomez commented 1 year ago

So I have a few questions: