mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-10 01:44:21 +01:00
Having a function allows for better error messages from the type checker and it makes it clearer to callers what can happen. For example: is_allowed!(req); Gives no indication that it may result in an early return, and no simple way for callers to modify the behaviour. It also makes it look like ownership of `req` is being transferred. On the other hand, is_allowed(&req)?; Indicates that `req` is being borrowed (immutably) and may fail. The question mark indicates that the caller wants an early return on failure. Fixes: #7201 Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>