E4215

E4215#

Compiler diagnostic name: expect_template_string.

Template writing expects a string template.

The <+ template-writing operator writes a string template to the value on its left. The right-hand side must be a string literal, an interpolated string, or a multiline string template. Other expressions cannot be expanded as template content.

Erroneous example#

pub fn render(value : String) -> String {
  let builder = StringBuilder::new()
  builder <+ value
  builder.to_string()
}

The right-hand side is a variable reference, not a template string.

Suggestion#

Use a string template on the right-hand side.

pub fn render(value : String) -> String {
  let builder = StringBuilder::new()
  builder <+ "\{value}"
  builder.to_string()
}