Use variable interpolation for println!.

This commit is contained in:
Stephen Chung
2022-10-27 13:38:21 +08:00
parent 6b24cc151e
commit 3c2e031883
24 changed files with 132 additions and 150 deletions

View File

@@ -37,10 +37,10 @@ fn main() -> Result<(), Box<EvalAltResult>> {
.register_fn("index_of", find_substring)
// Register string functions using closures
.register_fn("display", |label: &str, value: i64| {
println!("{}: {}", label, value)
println!("{label}: {value}")
})
.register_fn("display", |label: ImmutableString, value: &str| {
println!(r#"{}: "{}""#, label, value) // Quote the input string
println!(r#"{label}: "{value}""#) // Quote the input string
});
let mut scope = Scope::new();