This is my first post in a potentially new series, documenting things I've encountered or learned while using rust-lang. I have used the language before but I took a hiatus so I'm having to refresh and relearn a few things.
As I get back on the rust saddle, I'm finding more and more articles that I would like to refer back to. I'm still learning to use rust more effectively, so these might contain lessons and examples that some will considered "obvious."
If you're only interested in a list, visit the rust stuff! page!
Michael Bryan
This one seems to have a few posts that taught me something about rust in a pretty straightforward way. His posts on rust topics are definitely something I will want to come back to every so often, even if they are a few years old at this point.
- Common Newbie Mistakes and Bad Practices in
Rust: Bad Habits ― Few things can humble someone faster than "newbie mistakes" and finding out some of them might actually apply to me! Or some of them are rakes that I could've smacked myself on in the near future...like overusing iterators when a simpleforloop makes my code much more readable and understandable! This is the post that also introduced me to the Obstacles koan, a very amusing take on the importance ofrust's borrow checker. And the dangers ofunsafe. - Slice Patterns ― Recursion with match and slice patterns?! I definitely learned something new here!
Corrode.dev
- Don't Unwrap Options ― This was actually one of the first
rustpost that stuck out to me. One that I've had to refer back to if I've taken too long a break from the language and need a reminder. I don't want to shy away fromOptionandResult. I recognize them as very powerful and useful tools that prevents my code from panicking because I'm only human! But I need to get at the content without writing out a wholematchstatement.
TL;DR:let Some(value) = expr else { return; }
It can also be used to return an error, as is pointed out in the post's conclusion section.