The code from the answer is flagged as
error[E0015]: cannot call non-const formatting macro in constants
--> src/lib.rs:42:27
|
42 | Err(_) => unreachable!("Buffer is always ascii")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is it because it is nightly? How can I get rid of it?
jofas
2
If you use a panic directly instead of unreachable!
, Clippy doesn't mind:
match core::str::from_utf8(buffer) {
Ok(x) => x,
Err(_) => panic!("internal error: entered unreachable code: Buffer is always ascii"),
}
Playground.
1 Like
system
Closed
3
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.