rust: Fix deprecated use of panic!(format!(...))

warning: panic message is not a string literal
 --> src/bin/event_leak.rs:9:30
  |
9 |             Err(e) => panic!(format!(" could not create handle {:?}", e)),
  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(non_fmt_panic)]` on by default
  = note: this is no longer accepted in Rust 2021
  = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
This commit is contained in:
Richard W.M. Jones
2021-05-05 12:57:19 +01:00
parent d3bbc02190
commit d01ce08218
3 changed files with 3 additions and 3 deletions

View File

@@ -992,7 +992,7 @@ and generate_rust_bindtests () =
pr "fn main() {\n";
pr " let g = match Handle::create() {\n";
pr " Ok(g) => g,\n";
pr " Err(e) => panic!(format!(\" could not create handle {:?}\", e)),\n";
pr " Err(e) => panic!(\"could not create handle {:?}\", e),\n";
pr " };\n";
generate_lang_bindtests (
fun f args optargs ->

View File

@@ -5,7 +5,7 @@ fn main() {
for _ in 0..256 {
let mut g = match Handle::create() {
Ok(g) => g,
Err(e) => panic!(format!(" could not create handle {:?}", e)),
Err(e) => panic!("could not create handle {:?}", e),
};
g.set_event_callback(
|e, _, _, _| match e {

View File

@@ -6,7 +6,7 @@ fn main() {
for _ in 0..256 {
let mut g = match Handle::create() {
Ok(g) => g,
Err(e) => panic!(format!(" could not create handle {:?}", e)),
Err(e) => panic!("could not create handle {:?}", e),
};
g.set_event_callback(
|e, _, _, _| match e {