E0085

E0085#

Warning name: unlabelled_break_in_labelled_loop

Using an unlabelled break directly inside a labelled loop is deprecated. Once a loop has a label, name it in a break that targets the loop, even when the break is not nested inside another loop.

Erroneous example#

///|
pub fn stop_immediately() -> Unit {
  outer~: for i = 0; i < 3; i = i + 1 {
    ignore(i)
    break
  }
}

Suggestion#

Name the loop explicitly in the break.

///|
pub fn stop_immediately() -> Unit {
  outer~: for i = 0; i < 3; i = i + 1 {
    ignore(i)
    break outer~
  }
}