this post was submitted on 05 Jul 2025
314 points (98.5% liked)
Programmer Humor
25139 readers
1299 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
This was my experience too, until I learned a few things.
Box
,dyn
, andRc
.dyn
) isn't really necessary a lot of the time. Identify where you absolutely need it and solve everything else through other means.&
). Instead, try to re-think your structs and functions using composition and clone/copy instead. It's less efficient, but it's easier to optimize a running program, too.enum
,match
,if let
, and?
are weird, but are where you get the most leverage in the language. Try to master them.derive[...]
is a first-class feature with a lot of standard lib support. Always use this to make your custom types mesh with the standard lib more seamlessly.if
andmatch
are expressions, not statements! You can use either block to evaluate to a single value, useful in composite expressions likelet
. Example;let x=if y>20 { y } else { 0 };
Or use them to return values from functions (w/o need of a return statement).