15
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 26 Sep 2024
15 points (100.0% liked)
Rust Programming
7734 readers
1 users here now
founded 5 years ago
MODERATORS
There is a general mechanism in Rust that allows language users to add their own sugar. It's called macros 😉
You can remove
let
from the macro's fragment specifier and invocation.While macros are cool and it's good to keep them as an option in the back of the mind, it should be clarified that you're not supposed to immediately reach for macros for small things you don't quite like about the language.
Excessive macro use makes it impossible for others (including your future self) to read your code and there's often good reasons why it's designed like it is.
correct
incorrect
N/A. the macro above is trivial.
fiction
Oof, this brings back PTSD for a lot of us that have worked with developers like this ☝️