3 ms·
Ooo. I want to be able to do an expression in a format string. Instead of: format!("{}:{} wasn't able to connect to host {}.", file!(), line!(), db_opts.host
by eYrKEC2 2y ago
Ooo. I want to be able to do an expression in a format string.
Instead of:
format!("{}:{} wasn't able to connect to host {}.", file!(), line!(), db_opts.hostname);
I'd rather do:
format!("{file!()}:{line!()} wasn't able to connect to host {db_opts.hostname}.");
Yes, expressions in format strings can be abused, but knee-capping a pretty standard case (`instance.field`)to prevent outlier bad behavior seems like a premature optimization.