this post was submitted on 13 Jul 2023
0 points (NaN% liked)

Programming Horror

1879 readers
1 users here now

Welcome to Programming Horror!

This is a place to share strange or terrible code you come across.

For more general memes about programming there's also Programmer Humor.

Looking for mods. If youre interested in moderating the community feel free to dm @Ategon@programming.dev

Rules

Credits

founded 1 year ago
MODERATORS
 
top 1 comments
sorted by: hot top controversial new old
[–] nous@programming.dev 1 points 1 year ago

You can give it variables:

let foo = 4;
let bar = "bar";
format!("{foo}{bar}");

If you have a format string that long with arbatary expressions putting them all raw in the format string is not going to improve much. Better to give them actual names first.