Use identifiers in format!

This commit is contained in:
Stephen Chung
2022-08-11 19:01:23 +08:00
parent ceaf9fab1b
commit be448dfe4d
36 changed files with 164 additions and 206 deletions

View File

@@ -39,14 +39,12 @@ fn test_print_debug() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
engine
.on_print(move |s| log1.write().unwrap().push(format!("entry: {}", s)))
.on_print(move |s| log1.write().unwrap().push(format!("entry: {s}")))
.on_debug(move |s, src, pos| {
log2.write().unwrap().push(format!(
"DEBUG of {} at {:?}: {}",
src.unwrap_or("unknown"),
pos,
s
))
let src = src.unwrap_or("unknown");
log2.write()
.unwrap()
.push(format!("DEBUG of {src} at {pos:?}: {s}"))
});
// Evaluate script