7 points · by LinuxBender · 1y ago · 1 comment
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.