Sakura Lang

D030 option_expect_none

Option.expect was called on None.

A runtime defect: the running program stops with it; no compile phase reports it, and try cannot catch it. sakura explain D030 prints this explanation offline.

Option.expect was called on None. Use expect only where None is a bug; otherwise match on the option or use Option.unwrap_or(o, default).

Runtime defects come from running programs, so compiler/tests/ui has no fixture for them; the explanation above names the repair.

Edit on GitHub