The part after : in an interpolation isn't a valid format spec. Specs are an optional
alignment <, > or ^ with a width, an optional 0 for zero-padding, an optional
precision, and for an int an optional base x, X, o or b: {x:.2}, {n:>5},
{n:05}, {s:<10}, {n:08x}.
Wrong#
fn sci(x: float): str = "{x:e}"Fixed#
fn sci(x: float): str = "{x:.3}"Common causes#
- Format types from Python or Rust other than
x,X,oandb(:e,:?): not supported. - A
:in the text right after an interpolation: write{x}{{... or separate it with a space.