Inside a string, { starts an interpolation {expr} or {expr:spec}. This one is empty,
never closed, or has something other than } or : after its expression.
Wrong#
fn braces(): str = "empty: {}"Fixed#
fn braces(): str = "empty: {{}}"Common causes#
- Literal braces in text (JSON, code): write
{{and}}. - A
{whose}is missing. - Two expressions in one interpolation (
{a b}): use{a} {b}. - A format spec without the
:({x .2}): write{x:.2}.