E0023

E0023#

Warning name: unused_try

The body of this try expression never raises any error.

Erroneous example#

///|
fn main {
  println("Hello, world!") catch { // `try` is omitted here
    _ => println("Error")
  }
  try {
    println("Hello, ")
    println("world!")
  } catch {
    _ => println("Error in try block")
  }
}

Suggestion#

Remove the try expression:

///|
fn main {
  println("Hello, world!")
}