E0062#

Warning name: invalid_cascade

Calling method with non-unit return type via ...

The cascade operator .. is intended for chaining methods that return Unit. Using it with a method that returns a non-Unit value emits this warning.

Erroneous example#

test {
  ignore(
    StringBuilder::new()
      ..write_string("a")
      ..to_string(),
  )
}

Suggestion#

Call non-Unit methods with . instead:

test {
  let s = StringBuilder::new()
    ..write_string("a")
    .to_string()
  inspect(s, content="a")
}