menu
prefer-eager-fallback
Prefer eager fallbacks when deferred evaluation cannot avoid work
Result.unwrapOrElse adds an unnecessary callback when its fallback is Copy and effect-free.
Instead, you SHOULD pass the expression directly to unwrapOr.
Reported
1function value(result: Result<int32, string>): int32 {2 return result.unwrapOrElse(() => 0);3}Accepted
1function value(result: Result<int32, string>): int32 {2 return result.unwrapOr(0);3}