CocooFilter::add() currently returns false if the item could not be inserted, which is easy to ignore. Such a situation should be considered an error, so the function should probably return values of type Result<(), CocooFilterError> and value Err(CocooFilterError::TableFull) instead of false. Since Result is a #[must_use]-type, the compiler will warn the library's user if a situation where the item was not inserted is not handled.
CocooFilter::add()
currently returnsfalse
if the item could not be inserted, which is easy to ignore. Such a situation should be considered an error, so the function should probably return values of typeResult<(), CocooFilterError>
and valueErr(CocooFilterError::TableFull)
instead offalse
. SinceResult
is a#[must_use]
-type, the compiler will warn the library's user if a situation where the item was not inserted is not handled.