How to make this `unreachable` statement nicer?

Is there a way to remove this unreachable statement:

   let db_conn = PgConnection::establish(database_url).unwrap_or_else(|_| {
        log_panic!(log, "Error connecting to {}", database_url); // this calls `panic!` under the hood.
        unreachable!();
    });

Somehow the compiler does not see the panic invocation and wants should return Connection etc. If I replace log_panic! with a normal panic! it works and unreachable! can be removed.

Ah strange after compilation it worked... so the compiler really sees my panic. Maybe a rust-analyzer error ... or spurious thing

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.