Open code423n4 opened 2 years ago
I am really strongly opposed to cult like rules like 'no unwrap'. I can agree that moving this sort of log, unwrap behavior into a handler function that is then re-used could prevent mistakes where unwrap is improperly used. But banning tools is not a good way to engineer anything.
Anyways I agree this is a valid style nit.
reopening as per judges assessment as "primary issue" on findings sheet
Handle
nascent
Vulnerability details
[I-02] Anti-pattern
is_err()
,return
, then.unwrap()
Severity: Medium
Throughout the code this pattern is used:
The same pattern is used with
Option<>
types (is_some()
). Problems can arise when many.unwrap()
s become the norm, allowing for unintentional opportunities for crashes.Recommendation
One alternative that avoids
.unwrap()
ing intermediateResult
s andreturn
ing could be to use combinators